类 InMemoryQueueManager
java.lang.Object
io.github.a2ap.core.server.impl.InMemoryQueueManager
- 所有已实现的接口:
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.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Creates or retrieves the main event queue for a task.Retrieves the main event queue for a task without creating it.voidRemoves and closes the event queue for a task.Taps into an existing task's event queue to create a child queue.
-
构造器详细资料
-
InMemoryQueueManager
public InMemoryQueueManager()
-
-
方法详细资料
-
create
从接口复制的说明:QueueManagerCreates or retrieves the main event queue for a task.- 指定者:
create在接口中QueueManager- 参数:
taskId- The ID of the task.- 返回:
- The EventQueue for the task.
-
tap
从接口复制的说明:QueueManagerTaps 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
从接口复制的说明:QueueManagerRetrieves 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
从接口复制的说明:QueueManagerRemoves and closes the event queue for a task.- 指定者:
remove在接口中QueueManager- 参数:
taskId- The ID of the task.
-