GithubHelp home page GithubHelp logo

vardius / message-bus Goto Github PK

View Code? Open in Web Editor NEW
266.0 8.0 44.0 2.08 MB

Go simple async message bus

Home Page: http://rafallorenz.com/message-bus

License: MIT License

Go 31.06% JavaScript 66.71% CSS 2.23%
message-bus event-sourcing ddd async message-queue message-broker broker queue pubsub

message-bus's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

message-bus's Issues

subscriber process event asyncly

I merged it #6 but have to think about it if this is an improvement or not, it increases allocations number
plus if the number of subscribers is high it actually slows down

before

BenchmarkPublish-4                   	 5214352	       226 ns/op	       0 B/op	       0 allocs/op
BenchmarkSubscribe-4                 	  632084	      3319 ns/op	     730 B/op	       5 allocs/op
Benchmark1Subscriber1Topic-4         	 5545311	       225 ns/op	       0 B/op	       0 allocs/op
Benchmark1Subscriber100Topics-4      	 2261838	       808 ns/op	       0 B/op	       0 allocs/op
Benchmark100Subscribers1Topic-4      	   61615	     19539 ns/op	       0 B/op	       0 allocs/op
Benchmark100Subscribers100Topics-4   	   60561	     34031 ns/op	       0 B/op	       0 allocs/op

after

BenchmarkPublish-4                   	  598759	      1981 ns/op	       2 B/op	       0 allocs/op
BenchmarkSubscribe-4                 	 1000000	      4218 ns/op	     725 B/op	       4 allocs/op
Benchmark1Subscriber1Topic-4         	  629875	      1899 ns/op	      13 B/op	       0 allocs/op
Benchmark1Subscriber100Topics-4      	  621306	      1935 ns/op	       0 B/op	       0 allocs/op
Benchmark100Subscribers1Topic-4      	    6942	    206815 ns/op	    3343 B/op	       8 allocs/op
Benchmark100Subscribers100Topics-4   	    6996	    320923 ns/op	    8107 B/op	      16 allocs/op

Originally posted by @vardius in #6 (comment)

Did not release new version yet, will think about it and either revert or release
would love to hear second opinion about it.

	go func() {
 		for args := range h.queue {
- 			h.callback.Call(args)
+		 	go func(targs []reflect.Value) {
+ 				h.callback.Call(targs)
+ 			}(args)
 		}
 	}()

Personally I think it is up to a developer of a handler to execute his callback in a goroutine or not, up to him and the package itself should not enforce goroutine here.
cc @me020523

When is it used?

Your code is great, but I don't know how to use it. Is there a real application scenario?

How does this compare with systems like Kafka and RabbitMQ?

How does this library compare with the usage of systems like Kafka and RabbitMQ as message transporters?
Particularly in terms of performance and security.

Edit: just took a look at the code, it seems like this library doesn't do what I thought.
So is it accurate to say that it's a sync RWMutex wrapper utility?
How can one use it to establish connection between microservices, if at all possible?

Could you keep the 'v1.0.0' interface?

I like the new interface. Really, I used the semaphore to control concurrency outside the bus.
And, I hope to keeps both the old interface and the new interface.

v1.0.0

func New() MessageBus {

v1.1.0

func New(maxConcurrentCalls int) MessageBus {

Ref: dd40db9#diff-ecf9c6bcdc8d97b7f04226e8857c1108L82

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.