Package org.a2aproject.sdk.server.events
Interface StreamCloseHandle
public interface StreamCloseHandle
Handle for closing all active streams (ChildQueues) for a task.
Passed to
TaskStreamLifecycleHook callbacks to allow
user-controlled stream lifecycle management.-
Method Summary
Modifier and TypeMethodDescriptionvoidGracefully closes all active ChildQueues for this task.intReturns the number of active ChildQueues (subscribers) for this task.
-
Method Details
-
closeStreams
void closeStreams()Gracefully closes all active ChildQueues for this task. Events already in ChildQueue deques will be drained before the stream terminates. The MainQueue stays alive for non-finalized tasks — new clients can resubscribe, and the agent can keep emitting events. If the task is already finalized, the MainQueue will also close after the last child is removed (existing lifecycle behavior). -
getActiveSubscriberCount
int getActiveSubscriberCount()Returns the number of active ChildQueues (subscribers) for this task.- Returns:
- the active subscriber count
-