An open API service providing repository metadata for many open source software ecosystems.

Package Usage: go: github.com/mustafaturan/bus

Package bus is a minimalist event/message bus implementation for internal communication The package requires a unique id generator to assign ids to events. You can write your own function to generate unique ids or use a package that provides unique id generation functionality. The `bus` package respect to software design choice of the packages/projects. It supports both singleton and dependency injection to init a `bus` instance. Here is a sample initilization using `monoton` id generator: Example code for configuration: To emit events to the topics, topic names should be registered first: Example code: To receive topic events you need to register handlers; A handler basically requires two vals which are a `Handle` function and topic `Matcher` regex pattern. Example code: Example code: When an event is emitted, the topic handlers receive the event synchronously. It is highly recommended to process events asynchronous. Package leave the decision to the packages/projects to use concurrency abstractions depending on use-cases. Each handlers receive the same event as ref of `bus.Event` struct.
7 versions
Latest release: over 5 years ago
34 dependent packages

View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/mustafaturan/bus

Dependent Repos 0