Dispatcher
Defined in: channels/dispatcher.ts:101
Turns submit(sessionId, message) calls into throttled runAgent runs.
See the module:channels/dispatcher | module docs for the model.
Accessors
inFlight
Get Signature
get inFlight(): number;Defined in: channels/dispatcher.ts:145
Runs currently in flight across all sessions.
Returns
number
Constructors
Constructor
new Dispatcher(options): Dispatcher;Defined in: channels/dispatcher.ts:108
Parameters
| Parameter | Type |
|---|---|
options | DispatcherOptions |
Returns
Dispatcher
Methods
addSessionListener()
addSessionListener(listener): void;Defined in: channels/dispatcher.ts:140
Attach a session-aware event listener after construction. This is what
lets a caller own the dispatcher and still hand it to a ChannelBridge
(which attaches its reply router this way) — both observe every run's
events, tagged with their sessionId.
Parameters
| Parameter | Type | Description |
|---|---|---|
listener | SessionEventListener | Called for every event of every run. |
Returns
void
stats()
stats(): DispatcherStats;Defined in: channels/dispatcher.ts:150
Aggregate backpressure readings — what an adaptive controller acts on.
Returns
submit()
submit(sessionId, ...messages): void;Defined in: channels/dispatcher.ts:171
Enqueue one or more messages for a session and ensure it is being pumped. Non-blocking: always returns immediately so the caller (a socket handler) can keep draining its transport. Backpressure is applied at the buffer, never here.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The session/thread the messages belong to. |
...messages | Message[] | The inbound message(s). |
Returns
void