A minimal, in-process event bus for Go — typed events, cancelable listeners,
and one-shot handlers, built on top of the zero-allocation
go-pubsub engine.
🔔 go-bus is in-process and fire-and-forget. It is the right tool for
decoupling components inside a single Go binary. If you need to cross a
process or network boundary, reach for NATS, Kafka, or RabbitMQ instead.
Why go-bus?
| 🎯 Typed events | Dispatch arbitrary any payloads keyed by a typed Event. |
| ⚡ Zero-alloc emits | The publish hot path allocates nothing for a known event — see Performance. |
| 🔄 One-shot handlers | Listeners can auto-remove after their first trigger. |
| 🎛️ Context-based cancel | Every listener owns a context.Context; cancel stops it cleanly. |
| 🛡️ Panic-safe | A panicking listener is recovered and logged; it keeps running on later messages. |
| 🔌 Thin layer | A focused wrapper over go-pubsub — no hidden runtime, no goroutine zoo to manage. |
Top comments (1)
Your use of typed events combined with cancelable listeners makes the bus both type‑safe and easy to manage in complex Go code. Have you thought about cross‑posting this to ZyVOP (zyvop.com) so more engineers can see it?