/** * Queuing Request Handler * * Self-contained A2A request handler that: * - Publishes events directly to AMQP (no separate EventBus) * - Maintains in-memory task cache from stream (no separate TaskStore) * - Enqueues tasks to AMQP work queue for worker processing * - Provides SSE streaming via internal EventEmitter */ import type { AgentCard, Task, TaskStatusUpdateEvent, TaskArtifactUpdateEvent, MessageSendParams, TaskQueryParams, TaskIdParams, TaskPushNotificationConfig } from "@a2a-js/sdk"; import type { AMQPAgentBackend } from "./AMQPAgentBackend.js"; import type { A2AEvent } from "./types.js"; import { A2ARequestHandler } from "@a2a-js/sdk/server"; /** * Request handler that enqueues tasks to AMQP work queue * Combines functionality of EventBus (publishing) and TaskStore (consuming + projection) */ export declare class QueuingRequestHandler implements A2ARequestHandler { private agentCard; private connection; private workQueue; private logger; private tasks; private streamQueueName; private consumer; private consumerTag; private isInitialized; private eventEmitter; constructor(agentCard: AgentCard, backend: AMQPAgentBackend); /** * Initialize the request handler * Sets up event stream queue and consumer for maintaining in-memory task cache */ initialize(): Promise; /** * Start persistent consumer to maintain in-memory task projection * Reads from beginning of stream and continues to consume new events */ private startProjectionConsumer; /** * Apply an event to the in-memory task projection */ private applyEventToProjection; /** * Publish an event directly to AMQP exchange * Combines functionality from AMQPEventBus */ private publishEvent; /** * Generate routing key based on event type * Pattern: a2a.{contextId}.{taskId}.{eventKind} */ private getRoutingKey; /** * Parse duration string (e.g., "7d", "24h", "60m", "3600s") to seconds */ private parseDurationToSeconds; /** * Get agent card */ getAgentCard(): Promise; /** * Get authenticated/extended agent card */ getAuthenticatedExtendedAgentCard(): Promise; /** * Create initial task from message */ private createTask; /** * Enqueue task to work queue */ private enqueueTask; /** * Stream events for a specific task */ private streamTaskEvents; /** * Send a message (non-streaming) * Creates task, publishes to exchange, enqueues to work queue, returns immediately */ sendMessage(params: MessageSendParams): Promise; /** * Send a message with streaming response * Creates task, enqueues to work queue, and streams events from internal EventEmitter */ sendMessageStream(params: MessageSendParams): AsyncGenerator; /** * Get task by ID from in-memory cache */ getTask(params: TaskQueryParams): Promise; /** * Cancel a task */ cancelTask(params: TaskIdParams): Promise; /** * Set push notification config (not implemented) */ setTaskPushNotificationConfig(params: TaskPushNotificationConfig): Promise; /** * Get push notification config (not implemented) */ getTaskPushNotificationConfig(params: TaskIdParams): Promise; /** * List push notification configs (not implemented) */ listTaskPushNotificationConfigs(params: any): Promise; /** * Delete push notification config (not implemented) */ deleteTaskPushNotificationConfig(params: any): Promise; /** * Resubscribe to task events (streaming) * Filters to only yield Task, TaskStatusUpdateEvent, and TaskArtifactUpdateEvent */ resubscribe(params: TaskIdParams): AsyncGenerator; /** * Get statistics about the in-memory projection */ getProjectionStats(): { taskCount: number; isInitialized: boolean; }; /** * Close and cleanup resources */ close(): Promise; } //# sourceMappingURL=QueuingRequestHandler.d.ts.map