Documentation: GoDoc
Build Status:
Test Coverage: TBD
go-exchange is an in-process message (or event) exchange for Go (Golang), featuring:
- Publish-Subscribe with topic-based prefix subscriptions.
This is a very young project and the API can and probably will change.
Any ideas on how to make the API or anything else better are welcome.
import "github.com/tchap/go-exchange/exchange"
This section describes the messaging patterns that go-exchange implements.
Publish-subscribe is based on topics and event handlers can be registered for
particular topic prefixes. What that means is that an event handler registered
for git
topic will be as well activated when an events of kind git.push
is
received.
ex := exchange.New()
ex.Subscribe(ex.Topic("git"), func(topic exchange.Topic, event exchange.Event) {
fmt.Printf("Event received:\n topic: %q\n body: %v\n", topic, event)
})
ex.Publish(exchange.Topic("git.push"), "b839dc656e3e78647c09453b33652b389e37c07a")
ex.Terminate()
// Output:
// Event received:
// topic: "git.push"
// body: b839dc656e3e78647c09453b33652b389e37c07a
- Limit how many handlers can be running at the same time.
- go-patricia - trie that is being used in this project for managing subscriptions
MIT, see the LICENSE
file.