Skip to main content

Documentation Index

Fetch the complete documentation index at: https://abxbus.archivebox.io/llms.txt

Use this file to discover all available pages before exploring further.

Handler return values are captured in EventResult records and can be consumed as a single value or aggregated across handlers. Repository example files:

Typed return values

Use the event result type to enforce return typing across handlers.
from abxbus import BaseEvent, EventBus

class DoMathEvent(BaseEvent[int]):
    a: int
    b: int

def add(event: DoMathEvent) -> int:
    return event.a + event.b

bus = EventBus('AppBus')
bus.on(DoMathEvent, add)

event = await bus.emit(DoMathEvent(a=2, b=3)).now()
result = await event.event_result()

Aggregating multiple handler results

When multiple handlers respond to the same event, collect all successful values with the list helpers.
event = await bus.emit(GetConfigEvent()).now()
values = await event.event_results_list(raise_if_any=False, raise_if_none=False)

Result list options

await event.event_results_list(raise_if_any=False, raise_if_none=False)
await event.event_results_list(include=lambda result, _: isinstance(result, dict), raise_if_any=False)
completed = await event.wait(timeout=0.25)
await completed.event_results_list()
  • Default options are raise_if_any=true and raise_if_none=false in every runtime.
  • raise_if_any: raise if any handler ended with an error.
  • raise_if_none: raise only when no handlers returned a valid value after filtering; it does not raise just because one handler returned None/null/undefined.
  • If every handler errors, only raise_if_any=false plus raise_if_none=false suppresses the error and returns no value/empty list; every other option combination raises.
  • A single handler error is raised as that error; multiple handler errors are raised as an aggregate/exception-group shape.
  • Default filtering includes only completed, successful, non-empty scalar/object/list values and excludes forwarded BaseEvent returns.
  • Go accepts no args for defaults (event.EventResult() / event.EventResultsList()) and a single nil options value is equivalent to defaults.

Per-handler inspection

All runtimes keep per-handler result metadata in addition to the aggregate result helpers.
by_name = {result.handler_name: result.result for result in event.event_results.values()}