Creates an ArvoEventRouter instance with specified configuration.
Router configuration containing source, handlers, and execution parameters
Readonly
executionunitsComputational cost metric for router operations. Used for resource tracking and billing calculations.
Readonly
handlersRegistry mapping event types to their handlers
Readonly
sourceSource identifier for the router used in event routing
Readonly
spanThe OpenTelemetry span options
System error schema configuration.
Error events follow format: sys.
Routes and executes an event through its appropriate handler. Creates a telemetry span, validates the event destination, finds a matching handler, and processes the event. Handles routing errors, missing handlers, and execution failures by returning error events with telemetry context. Tracks performance through execution units and span propagation.
The event to be routed and processed
Configuration for telemetry context inheritance
Promise resolving to resulting events or error events
ArvoEventRouter manages event routing and execution within the Arvo event system. It directs incoming events to appropriate handlers based on event type while maintaining telemetry and error handling.
The router enforces contract validation, manages execution costs, and provides comprehensive telemetry via OpenTelemetry integration. It handles event lifecycle management from initial receipt through processing and response generation.
Example