类 InMemoryQueueManager

java.lang.Object
io.github.a2ap.core.server.impl.InMemoryQueueManager
所有已实现的接口:
QueueManager

public class InMemoryQueueManager extends Object implements QueueManager
In-memory implementation of QueueManager for managing task event queues. This implementation manages EventQueue instances for tasks using a thread-safe ConcurrentHashMap. It provides the core functionality for creating, accessing, and managing event queues that facilitate streaming communication between agents and clients in the A2A protocol. Key features: - Thread-safe queue management using ConcurrentHashMap - Support for queue creation and retrieval by task ID - Queue tapping functionality for creating child queues - Automatic cleanup when queues are removed - Comprehensive logging for debugging and monitoring Queue lifecycle: 1. create() - Creates a new EventQueue for a task (idempotent) 2. get() - Retrieves an existing queue without creating 3. tap() - Creates a child queue that receives the same events 4. remove() - Removes and closes the queue, cleaning up resources This implementation is suitable for single-instance deployments and provides the foundation for streaming task updates and real-time communication in the A2A protocol. For distributed deployments, consider implementing QueueManager with a distributed messaging system.
  • 构造器详细资料

    • InMemoryQueueManager

      public InMemoryQueueManager()
  • 方法详细资料

    • create

      public EventQueue create(String taskId)
      从接口复制的说明: QueueManager
      Creates or retrieves the main event queue for a task.
      指定者:
      create 在接口中 QueueManager
      参数:
      taskId - The ID of the task.
      返回:
      The EventQueue for the task.
    • tap

      public EventQueue tap(String taskId)
      从接口复制的说明: QueueManager
      Taps into an existing task's event queue to create a child queue.
      指定者:
      tap 在接口中 QueueManager
      参数:
      taskId - The ID of the task.
      返回:
      A new EventQueue that receives events from the main task queue, or null if no queue exists for this task.
    • get

      public EventQueue get(String taskId)
      从接口复制的说明: QueueManager
      Retrieves the main event queue for a task without creating it.
      指定者:
      get 在接口中 QueueManager
      参数:
      taskId - The ID of the task.
      返回:
      The EventQueue for the task, or null if it doesn't exist.
    • remove

      public void remove(String taskId)
      从接口复制的说明: QueueManager
      Removes and closes the event queue for a task.
      指定者:
      remove 在接口中 QueueManager
      参数:
      taskId - The ID of the task.