https://github.com/tsouza/go-bus
A lightweight in-memory message bus Go library
https://github.com/tsouza/go-bus
event eventbus go golang messaging pubsub
Last synced: 8 months ago
JSON representation
A lightweight in-memory message bus Go library
- Host: GitHub
- URL: https://github.com/tsouza/go-bus
- Owner: tsouza
- License: apache-2.0
- Created: 2021-11-19T16:20:34.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-03T12:14:07.000Z (over 4 years ago)
- Last Synced: 2024-06-20T17:40:03.255Z (about 2 years ago)
- Topics: event, eventbus, go, golang, messaging, pubsub
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-bus [](https://godoc.org/github.com/tsouza/go-bus) [](https://github.com/tsouza/go-bus/actions/workflows/test.yml)
`go-bus` is a lightweight golang library for implementing the [pub/sub pattern](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern). It supports wildcard topics as well as dynamic topic subscription.
## Usage
Basic pub/sub usage:
```go
package main
import (
"fmt"
"github.com/tsouza/go-bus"
)
func main() {
b := bus.New()
sub := b.Subscribe([]string{"my", "topic"}, func(t []string, s *bus.Subscription, p interface{}) {
fmt.Printf("%v world", p)
})
b.Publish([]string{"my", "topic"}, "hello")
sub.Terminate()
}
```
Check out more [examples](examples)
## License
Code and documentation released under [Apache License 2.0](LICENSE)