EventBusMiddleware defines the middleware hook contract used by EventBus in both runtimes.
Rust core event dispatch does not expose a public middleware trait yet. Use handler wrappers or inspect EventBus::to_json_value() / event result state directly until Rust middleware parity lands.
Interface
- Python
- TypeScript
- Go
- Rust
Setup with EventBus
- Python
- TypeScript
- Go
- Rust
Lifecycle behavior
on_event_change/onEventChangeruns on event lifecycle transitions.on_event_result_change/onEventResultChangeruns on handler-result lifecycle transitions.on_bus_handlers_change/onBusHandlersChangeruns when handlers are added/removed.- Hook
statusvalues are onlypending,started, andcompleted. - Handler failures are represented on
event_result.status == 'error'andevent_result.errorwhen the hook status iscompleted.
Custom middleware example
- Python
- TypeScript
- Go
- Rust
Built-in implementations
- Python
- TypeScript
- Go
- Rust
OtelTracingMiddlewareAutoErrorEventMiddlewareAutoReturnEventMiddlewareAutoHandlerChangeEventMiddlewareWALEventBusMiddlewareLoggerEventBusMiddlewareSQLiteHistoryMirrorMiddleware