Skip to content

tchap/go-exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-exchange

Documentation: GoDoc
Build Status: Build Status
Test Coverage: TBD

About

go-exchange is an in-process message (or event) exchange for Go (Golang), featuring:

  • Publish-Subscribe with topic-based prefix subscriptions.

State of the Project

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.

Usage

import "github.com/tchap/go-exchange/exchange"

Patterns

This section describes the messaging patterns that go-exchange implements.

Publish-Subscribe

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.

Example
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

Ideas

  • Limit how many handlers can be running at the same time.

Related Projects

  • go-patricia - trie that is being used in this project for managing subscriptions

License

MIT, see the LICENSE file.

Gittip Badge

Bitdeli Badge

About

In-process message exchange for Go (Golang)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages