Skip to content

symfonic.kernel.fanout

fanout

Callback fan-out: the one adapter that owns work instead of just projecting.

Its own module because it is the only shipped adapter with a lifecycle. The projections in :mod:symfonic.kernel.adapters are pure functions of the event stream and end when it does; this one may buffer, may run a drain worker, and therefore must be created, drained, reported, and released by the run that owns it (RCX-8, BP-8, BP-12).

CallbackEventAdapter

CallbackEventAdapter(policy: EventAdapter, callbacks: Iterable[Callable[[KernelEvent], Any]], *, deadline_seconds: float | None, context: RequestContext | None = None)

Awaited, ordered, error-isolated callback event delivery.

Source code in src/symfonic/kernel/fanout.py
def __init__(
    self,
    policy: EventAdapter,
    callbacks: Iterable[Callable[[KernelEvent], Any]],
    *,
    deadline_seconds: float | None,
    context: RequestContext | None = None,
) -> None:
    self._policy = policy
    self._callbacks = tuple(callbacks)
    self._deadline_seconds = deadline_seconds
    self._context = context
    self._buffer = (
        BoundedEventBuffer(policy, deadline_seconds=deadline_seconds)
        if policy.buffer == "bounded"
        else None
    )
    self._worker: asyncio.Task[Any] | None = None
    self._terminal_owed = False
    self.failures = 0