Class EventQueue.EventQueueBuilder

java.lang.Object
org.a2aproject.sdk.server.events.EventQueue.EventQueueBuilder
Enclosing class:
EventQueue

public static class EventQueue.EventQueueBuilder extends Object
Builder for creating configured EventQueue instances.

Supports configuration of queue size, enqueue hooks, task association, close callbacks, and task state providers.

  • Constructor Details

    • EventQueueBuilder

      public EventQueueBuilder()
  • Method Details

    • queueSize

      public EventQueue.EventQueueBuilder queueSize(int 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

      public EventQueue.EventQueueBuilder taskId(String taskId)
      Associates this queue with a specific task ID.
      Parameters:
      taskId - the task identifier
      Returns:
      this builder
    • addOnCloseCallback

      public EventQueue.EventQueueBuilder addOnCloseCallback(Runnable onCloseCallback)
      Adds a callback to be executed when the queue is closed.
      Parameters:
      onCloseCallback - the callback to execute on close
      Returns:
      this builder
    • taskStateProvider

      public EventQueue.EventQueueBuilder taskStateProvider(TaskStateProvider taskStateProvider)
      Sets the task state provider for tracking task finalization.
      Parameters:
      taskStateProvider - the task state provider
      Returns:
      this builder
    • mainEventBus

      public EventQueue.EventQueueBuilder mainEventBus(MainEventBus mainEventBus)
      Sets the main event bus
      Parameters:
      mainEventBus - the main event bus
      Returns:
      this builder
    • build

      public EventQueue build()
      Builds and returns the configured EventQueue.
      Returns:
      a new MainQueue instance