Git Product home page Git Product logo

go-eventbus's Introduction

EventBus for Go

go-eventbus is a library of publish/subscribe event bus for Golang, inspired by EventBus

go-eventbus targets on decouple. Go language already ensure a good performance.

Different decouple tech stacks

Components doesn't rely on each other. They publish events to EventBus, and retrieve interested event from that too.

  • Actor model

Component call others by name. Controller hold name <--> components mapping. Then it's possible to use different components in different env for same name


As you can see, go-eventbus is designed for event based system. Normally, for event based system, workflow is like:

  1. Something happened: event generated
  2. Some component, like A do something to respond the event (eg. when user click a url, open a website tab)
  3. After that, A wait for another event to come

EventBus could help you decouple components

Instead of calling: http.post(xxx)

Consider using EventBus: bus.Request(HttpPostEvent).GetResult()

HttpPostEvent is responded by another component. It could made a real HTTP call in PRD, or it could return directly by a mocked component. All that depends on what components are attached to the bus.


Performance

Benchmark:

  • 1 response to each event: 50000~100000 event dispatch per sec
  • 5 responses to each event: 20000 event dispatch per sec
  • It's not ideal, performance is still improving

Examples

TODO

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.