An in-memory message broker build with Go.
Go-Queue is an in-memory message broker which is thread safe and is Interface based. It provides a comprehensive way of subscription to topics based on pattern match.
go get github.com/Dev-Destructor/go-queue
func main() {
broker := mq.NewBroker()
}
func main() {
broker := mq.NewBroker()
testSubscriber := broker.Subscribe(mq.ExactMatcher("test"))
}
func main() {
broker := mq.NewBroker()
testSubscribers := broker.Subscribe(regexp.MustCompile(`tests\.\w*`))
}
func main() {
broker := mq.NewBroker()
broker.Publish("test", "Hello World")
}
func main() {
broker := mq.NewBroker()
testSubscriber := broker.Subscribe(mq.ExactMatcher("test"))
go func() {
value, ok := testSubscriber.Poll()
if !ok {
return
}
fmt.Println(value)
}()
}