Class WakeupDispatcher
java.lang.Object
io.agentscope.harness.agent.gateway.WakeupDispatcher
- All Implemented Interfaces:
AutoCloseable
Per-process dispatcher that wakes idle sessions when background work completes.
Subscribes to the shared wakeup signal channel on MessageBus.subscribeWakeup() and
drains the durable wakeup queue on each signal. For each queued entry whose target session is
idle, triggers a new reasoning round via WakeupDispatcher.WakeupTarget.runWakeup(String).
It serves as the universal activator for all cross-session communication:
- Background subagent task completion
- Async tool results (
AsyncToolMiddleware) - Team messages (future Agent Teams support)
- Scheduled task triggers
Lifecycle: call start() after the gateway is fully configured. Call close()
on shutdown. Typically managed by the application bootstrap or gateway factory.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThin interface for the two gateway operations the dispatcher needs. -
Constructor Summary
ConstructorsConstructorDescriptionWakeupDispatcher(MessageBus messageBus, WakeupDispatcher.WakeupTarget target) -
Method Summary
-
Constructor Details
-
WakeupDispatcher
-
-
Method Details
-
start
public void start()Starts the dispatcher: performs an initial drain of any queued wakeups (to pick up signals produced while this process was down), then subscribes to the live signal channel. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-