evoq_event_router (evoq v1.30.1)
View SourceRoutes events to handlers by event type.
Receives events from reckon-db subscriptions and routes them to interested handlers based on event type.
Key features: - Per-event-type routing (not per-stream) - Event upcasting before delivery - Delivery isolated per handler (see below) - Telemetry for observability
Delivery isolation
Each local handler process gets its own courier: a process that hands it its events with evoq_event_handler:notify/4, one at a time, in the order the router routed them. The router only passes an event to the courier, so a handler that is slow, blocked, or sleeping out a {retry, DelayMs} backoff delays its own events and nobody else's. Before, the router made that call itself, handler after handler, and one slow handler held up every handler and projection on the node (evoq#30). The handler still acknowledges its own write to a strong-consistency waiter. A courier ends when its handler does.
Summary
Functions
The type this event is delivered as, and the handler processes that delivery reaches.
Route an event to interested handlers.
Route an event with options.
Route multiple events to interested handlers.
Start the event router.
Functions
The type this event is delivered as, and the handler processes that delivery reaches.
Read from the registry, through the same upcasting the delivery does, so a caller asking "who will see this event" gets the answer the router acts on. evoq_consistency asks it to derive what a strong dispatch must wait for; nothing keeps a list.
Route an event to interested handlers.
Route an event with options.
targets => [pid()] delivers to exactly those handlers instead of every handler registered for the type. The store subscription uses it: it delivers a store's events only to handlers whose history from that store it has sent, and a late handler's history to that handler alone (evoq #4).
Route multiple events to interested handlers.
Start the event router.