AsyncDispatcher
class AsyncDispatcher(router: Router, tracer: Tracer = NullTracer, batchSize: Int = 5, pollDelayMs: Long = 10)
Coroutine-driven event dispatcher.
Events are pushed onto a FIFO queue with dispatch, the dispatcher loop picks them up in batches of batchSize, routes each event through the Router, and feeds any produced events back onto the queue. A TerminateEvent anywhere in the produced output stops the loop.
Call start with a caller-owned CoroutineScope to launch the loop, and stop (or cancel the scope) to shut it down. Tests can use waitForEmptyQueue to settle the queue before asserting.
Functions
Link copied to clipboard
Suspend until the queue is empty AND no agent is currently being awaited, or until timeoutMs elapses. Returns true if the queue drained, false on timeout.