EventHistory is the ordered event store owned by each EventBus as bus.event_history.
It is the canonical history backend in both runtimes and exposes mapping-style access ({event_id: event}), lookup (find), and retention controls.
Common fields
max_history_size: max retained events (None/nullmeans unbounded,0keeps only in-flight visibility)max_history_drop: whether to trim oldest entries when over limit- Ordered mapping keyed by
event_id
Mapping interface
EventHistory behaves like an ordered mapping in both runtimes.
- Python
- TypeScript
Accessor methods
Both runtimes expose explicit accessors in addition to mapping methods.- Python
- TypeScript
add_event(event)get_event(event_id)remove_event(event_id)has_event(event_id)find(...)trim_event_history(...)
find(...)
EventHistory.find(...) supports:
- event pattern (
'EventType', class, or'*') wherepredicate filtering- field equality filters (
**event_fieldsin Python, options object fields in TypeScript) past/futurewindowschild_ofconstraints
EventBus.find(...) delegates to event_history.find(...). Future waiter ownership remains on EventBus; the bus injects the callback used for future waits.
Retention and trim methods
trim_event_history/trimEventHistoryapplies configured retention policy.on_removecallbacks let the caller run cleanup side effects when history entries are removed.
Constructor options
- Python
- TypeScript