Go simple async message bus.
Contributors:
Want to contribute ? Feel free to send pull requests!
Have problems, bugs, feature ideas? We are using the github issue tracker to manage them.
CPU: 3,3 GHz Intel Core i7
RAM: 16 GB 2133 MHz LPDDR3
➜ message-bus git:(master) go test -bench=. -cpu=4
BenchmarkWorker-4 500000 2507 ns/op
PASS
package main
import (
"fmt"
"github.com/vardius/message-bus"
)
func main() {
bus := messagebus.New()
var wg sync.WaitGroup
wg.Add(2)
bus.Subscribe("topic", func(v bool) {
defer wg.Done()
fmt.Println(v)
})
bus.Subscribe("topic", func(v bool) {
defer wg.Done()
fmt.Println(v)
})
bus.Publish("topic", true)
wg.Wait()
}
This package is released under the MIT license. See the complete license in the package: