Code Monkey home page Code Monkey logo

go-exchange's Introduction

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

go-exchange's People

Contributors

rykov avatar tchap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.