The A2A protocol has been successfully refactored to adopt the MCP (Model Context Protocol) architecture, positioning EventMesh as a modern Agent Collaboration Bus.
EnhancedA2AProtocolAdaptor)jsonrpc detection).*.req events with mcptype=request.*.resp events with mcptype=response.id to CloudEvent collaborationid.params._agentId -> CloudEvent Extension targetagent (P2P).params._topic -> CloudEvent Subject (Pub/Sub)._topic to CloudEvent Subject.message/sendStream operation, mapping to .stream event type and preserving sequence via _seq -> seq extension.JsonRpcRequest, JsonRpcResponse, JsonRpcError POJOs compliant with JSON-RPC 2.0 spec.McpMethods constants for standard operations like tools/call, resources/read.AgentCard, AgentSkill, AgentInterface, AgentCapabilities for complete agent capability description.eventmesh-runtime)A standalone HTTP Gateway service bridging external clients to the A2A event bus.
| Component | Responsibility |
|---|---|
A2AGatewayServer | Netty HTTP server entry point, pre-registers mock agents, wires all components |
A2AGatewayHttpHandler | HTTP request router, supports SSE streaming responses |
A2AGatewayService | Core orchestration: task submission, response handling, status subscription, SSE push |
TaskRegistry | In-memory task state machine + TTL auto-cleanup |
A2APublishSubscribeService | AgentCard registration, discovery, heartbeat management |
InMemoryA2AMessageTransport | In-memory pub/sub (replaceable by EventMesh broker) |
A2ACardHttpHandler | AgentCard CRUD REST endpoints |
A2AClient | Java SDK with typed API |
| Method | Path | Description |
|---|---|---|
POST | /a2a/tasks?mode=sync | Submit task synchronously |
POST | /a2a/tasks?mode=async | Submit task asynchronously |
GET | /a2a/tasks/{taskId} | Get task status |
DELETE | /a2a/tasks/{taskId} | Cancel a task |
GET | /a2a/tasks/{taskId}/wait | Long-poll wait for result |
GET | /a2a/tasks/{taskId}/stream | SSE stream of task status updates |
GET | /a2a/agents | List registered agents |
POST | /a2a/heartbeat | Agent heartbeat |
GET | /a2a/cards/list | List all AgentCards |
POST | /a2a/cards/card/{org}/{unit}/{agent} | Register an AgentCard |
ScheduledExecutorService runs every 60 seconds, removing terminal-state tasks older than the TTL (default: 5 minutes).TaskRegistry(taskTtlMs, cleanupIntervalMs) constructor allows custom tuning.InMemoryTransport delivers messages synchronously. If transport.publish() executes before pendingTasks.put(), handleResponse() runs before put() and the future never completes.pendingTasks.put(taskId, future) is called before transport.publish(), with comments documenting the ordering importance.getTaskStatus() returns TaskResult object (instead of raw JSON string), listAgents() returns List<String> (instead of raw JSON).TaskResult.data field uses @JsonAlias("result") annotation to handle the server's result field name.GET /a2a/tasks/{taskId}/streamDefaultHttpContent chunks directly to the Netty channel, returning null to skip the standard FullHttpResponse path. Uses StatusSubscriber callbacks for real-time state push.eventmesh-examples/.../demo/README.md with architecture diagram, API table, curl examples, SDK usage, and run instructions.EnhancedA2AProtocolAdaptorTest covers Request/Response cycles, Error handling, Notifications, and Batching.A2ATopicFactoryTest covers topic generation and parsing.TaskRegistryTest — Task state machine + TTL cleanup verificationInMemoryA2AMessageTransportTest — In-memory transport deliveryA2AGatewayServiceTest — Gateway service layerA2AGatewayEndToEndTest — In-process end-to-end flowA2AClientServerIntegrationTest — Real HTTP client-server integration testMcpIntegrationDemoTest, McpPatternsIntegrationTest, McpComprehensiveDemoTest, CloudEventsComprehensiveDemoTestInMemoryA2AMessageTransport with the real EventMesh broker for production deployment.targetagent and a2amethod extension attributes for advanced routing rules.methods/list) dynamically.TaskRegistry state to a durable store (Redis/DB) for crash recovery.