asaskevich / EventBus

[Go] Lightweight eventbus with async compatibility for Go
MIT License
1.74k stars 220 forks source link

Two subscribers? #12

Closed rekby closed 9 years ago

rekby commented 9 years ago

As I see sources -

func (bus *EventBus) Subscribe(topic string, fn interface{}) error {
    ...
    bus.handlers[topic] = &eventHandler{
        v, false, false, false, sync.Mutex{},
    }
    ...
}

It bus support only one subscriber for each topic? If I add second subscriber it will overwrite first.

bennAH commented 9 years ago

Yes that is correct. You can send a pull request for the bus to support multiple subscribers

rekby commented 9 years ago

See the commit https://github.com/gaxunil/EventBus/commit/f71cc0121678ef2819822dba75b399d5cb7dcccd

I can't create pull request from other user commit (non branch - in next commit of the branch the user change the documents and library path in documents).

bennAH commented 9 years ago

I have run all the tests and they all pass. Will merge the changes. Thanks for your contribution

asaskevich commented 9 years ago

Thanks, @bennAH for merging https://github.com/gaxunil/EventBus/commit/f71cc0121678ef2819822dba75b399d5cb7dcccd and @rekby for pointing this issue, :+1: