Package org.a2aproject.sdk.server.events
Class EventQueue.EventQueueBuilder
java.lang.Object
org.a2aproject.sdk.server.events.EventQueue.EventQueueBuilder
- Enclosing class:
- EventQueue
Builder for creating configured EventQueue instances.
Supports configuration of queue size, enqueue hooks, task association, close callbacks, and task state providers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddOnCloseCallback(Runnable onCloseCallback) Adds a callback to be executed when the queue is closed.build()Builds and returns the configured EventQueue.hook(EventEnqueueHook hook) Sets the enqueue hook for event replication or logging.mainEventBus(MainEventBus mainEventBus) Sets the main event busqueueSize(int queueSize) Sets the maximum queue size.Associates this queue with a specific task ID.taskStateProvider(TaskStateProvider taskStateProvider) Sets the task state provider for tracking task finalization.
-
Constructor Details
-
EventQueueBuilder
public EventQueueBuilder()
-
-
Method Details
-
queueSize
Sets the maximum queue size.- Parameters:
queueSize- the maximum number of events that can be queued- Returns:
- this builder
-
hook
Sets the enqueue hook for event replication or logging.- Parameters:
hook- the hook to be invoked when items are enqueued- Returns:
- this builder
-
taskId
Associates this queue with a specific task ID.- Parameters:
taskId- the task identifier- Returns:
- this builder
-
addOnCloseCallback
Adds a callback to be executed when the queue is closed.- Parameters:
onCloseCallback- the callback to execute on close- Returns:
- this builder
-
taskStateProvider
Sets the task state provider for tracking task finalization.- Parameters:
taskStateProvider- the task state provider- Returns:
- this builder
-
mainEventBus
Sets the main event bus- Parameters:
mainEventBus- the main event bus- Returns:
- this builder
-
build
Builds and returns the configured EventQueue.- Returns:
- a new MainQueue instance
-