Class CloseStreamsHook

java.lang.Object
org.a2aproject.sdk.examples.streamlifecycle.server.CloseStreamsHook
All Implemented Interfaces:
TaskStreamLifecycleHook

@ApplicationScoped @Alternative @Priority(1) public class CloseStreamsHook extends Object implements TaskStreamLifecycleHook
Demonstrates closing all streams for a task when the subscriber count reaches a threshold.

When 3 subscribers are connected to the same task, this hook calls StreamCloseHandle.closeStreams() to gracefully close all active streams. The agent executor continues running, but disconnected clients can resubscribe later.