A minimalist, zero-allocation event bus implementation for internal communication in Go applications.
Bus is a minimalist event/message bus implementation for Go that enables internal communication between application components using a pub/sub pattern. It solves the problem of tight coupling between components by providing a lightweight messaging layer that allows different parts of an application to communicate without direct dependencies. The library is optimized for performance with zero-allocation operations during event emission.
Go developers building applications that require decoupled communication between components, particularly those working on microservices architectures, event-driven systems, or applications needing internal message passing.
Developers choose Bus for its combination of simplicity and performance—it provides just enough functionality for reliable event communication while maintaining zero-allocation emits for optimal speed. Unlike heavier messaging systems, Bus stays focused on internal communication without external dependencies.
🔊Minimalist message bus implementation for internal communication with zero-allocation magic on Emit
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show emits can run with 0 allocs/op, crucial for high-throughput applications where memory efficiency is key.
Topics must be registered before use, preventing accidental emissions and ensuring a controlled, predictable event flow.
Handlers can use regex patterns for topic matching, allowing dynamic and granular subscription without hardcoded topic lists.
Provides TxID and source tracking via context keys, simplifying event correlation and debugging in complex workflows.
Events are delivered synchronously, forcing implementers to manually add goroutines or queues for asynchronous processing, as the README explicitly warns.
Requires an external unique ID generator like 'monoton' for initialization, adding setup complexity and an extra dependency.
Designed only for internal communication within a single Go application; cannot be used for inter-process or distributed messaging without significant adaptation.