A set of reusable components for building a concurrent, message-oriented middleware in Go.
$ go get -u -d github.com/symfony-doge/event
One subscriber, multiple publishers, no special routing.
DefaultListener acts like a subscriber that receives and process events (i.e. messages in context of pubsub pattern) from multiple publishers. It listens a channel wrapped by ROListenerSession. This implementation doesn't support any custom routing.
See example code snippet:
var consumeFunc event.ConsumeFunc = func (e event.Event) {
fmt.Printf("An event has been received. Type: %d, Payload: %v\n", e.Type, e.Payload)
}
listenerSession := event.MustListen(consumeFunc)
defer listenerSession.Close()
var notifyChannel chan<- event.Event = listenerSession.NotifyChannel()
notifyChannel <- event.WithTypeAndPayload(1, "test payload 1")
notifyChannel <- event.WithTypeAndPayload(2, "test payload 2")
notifyChannel <- event.WithTypeAndPayload(3, "test payload 3")
Output will be:
An event has been received. Type: 1, Payload: test payload 1
An event has been received. Type: 2, Payload: test payload 2
An event has been received. Type: 3, Payload: test payload 3
- agoalofalife/event — The Observer pattern implementation in Go.
- olebedev/emitter — Emits events in Go way, with wildcard, predicates, cancellation possibilities and many other good wins.
- leandro-lugaresi/hub — A fast Message/Event Hub using publish/subscribe pattern with support for topics like* rabbitMQ exchanges for Go applications.
- asaskevich/EventBus — Lightweight eventbus with async compatibility for Go.
All notable changes to this project will be documented in CHANGELOG.md.