What it does
Register handlers on a Dispatcher. Create an EventStore with a bounded MPMC ring buffer. Enqueue events with Subscribe and dispatch them with Publish. Execution stays in Go. The decision layer is optional. With RuleCacheSelector, rules are evaluated first and the cache is checked next. The fallback selector runs only when neither resolves the decision. Successful fallback decisions can then be cached. JevSelector calls the OpenRouter Decisions API. Set OPENROUTER_API_KEY in your server environment and supply a bounded list of event candidates. JevSelector returns the selected choice, confidence and probabilities. Redis Streams and RabbitMQ providers move events between processes. The local EventStore runs your handlers. Remote providers need string projections for stable broker routing names.
Capabilities
- Fan-out to independent handlers through dispatcher.Register, where one handler's error does not keep the others from doing their work.
- FIFO delivery per ordering key in async mode through store.RegisterOrdered, while unrelated entities run concurrently.
- Batch collection of pending events into chunks during a publish cycle through store.RegisterBatch.
- Overflow policies DropOldest, Block and ReturnError decide what happens when the buffer fills.
- Middleware, lifecycle hooks and a replayable dead-letter queue that captures handler failures and recovered panics, replayed with store.DLQ.Replay.
When to use it
- You want a conventional event bus in Go that uses Subscribe and Publish, without Jev.
- Your events need to travel between services.
- Your input needs a decision before dispatch.