[ISSUE #5259] Add A2A Gateway: REST API, SSE streaming, Task lifecycle, Java SDK and tests#5260
Open
qqeasonchen wants to merge 8 commits into
Open
[ISSUE #5259] Add A2A Gateway: REST API, SSE streaming, Task lifecycle, Java SDK and tests#5260qqeasonchen wants to merge 8 commits into
qqeasonchen wants to merge 8 commits into
Conversation
…cle, Java SDK and tests ## What's New ### A2A Gateway Runtime (eventmesh-runtime) - A2AGatewayServer: standalone HTTP server entry point - A2AGatewayService: core gateway logic with task timeout, agent validation, cancel notification, and concurrent-safe status subscribers - A2AGatewayHttpHandler: Netty-based REST handler with CORS, SSE streaming, health check, task list pagination, and precise error codes - TaskRegistry: in-memory task lifecycle management with TTL cleanup, CopyOnWriteArrayList for parent-child concurrency safety - InMemoryA2AMessageTransport: default transport implementation - A2ACardHttpHandler: enhanced with CORS headers ### A2A Protocol Plugin (eventmesh-protocol-a2a) - A2AClient: typed Java SDK with sync/async task send, SSE streaming (streamTaskStatus), agent discovery, heartbeat, and SSE-aware socket timeout - A2AMessageTransport: transport abstraction interface - A2ATopicFactory: A2A topic convention standardization - A2ATopicFactoryTest: unit tests ### Examples - A2AGatewayDemo: end-to-end HTTP client demo ### Tests (all passing) - A2AGatewayServiceTest: 15+ tests covering timeout, agent validation, cancel, SSE, pagination - TaskRegistryTest: TTL, concurrent child creation, lifecycle transitions - A2AClientServerIntegrationTest: full client-server integration with SSE streaming, CORS, health, heartbeat - A2AGatewayEndToEndTest: end-to-end pipeline verification - InMemoryA2AMessageTransportTest: transport unit tests ### Documentation (7 files updated) - eventmesh-a2a-design.md, ARCHITECTURE.md, IMPLEMENTATION_SUMMARY.md, IMPLEMENTATION_SUMMARY_EN.md, TEST_RESULTS.md, README.md, README_EN.md ### Key Engineering Decisions - Task timeout: auto-fail non-terminal tasks after configurable threshold - SSE: heartbeat mechanism + socketTimeout(0) for long-lived connections - Concurrency: CopyOnWriteArrayList + ConcurrentHashMap throughout - CORS: Access-Control-Allow-Origin on all A2A endpoints - Agent validation: reject tasks for unregistered agents
Replace '-->' arrow notation with HTML entity '>' in Javadoc <pre> block to fix javadoc compilation error: 'bad use of ">". The '>' character inside <pre> blocks in Javadoc must be escaped as '>' when it appears after '-' characters (forming '-->' which Java parser misinterprets as an HTML comment end marker). Fixes: CodeQL Analyze (java) and all Build CI failures in PR apache#5260.
Replace '->' with '->' in Javadoc <pre> block to avoid javadoc 'bad use of >' compilation error. The Java parser interprets '>' in <pre> blocks as HTML tag closers. Fixes: remaining CI build failure in PR apache#5260 after first fix.
checkstyleMain (4 files, 8 violations): - Remove unused imports (ArrayList, Objects) - Fix import ordering per project convention: static first, then org.apache.eventmesh, org.apache, java, io, org.junit, com - Replace Unicode escape (\u00b0) with literal degree symbol - Add missing Javadoc for StatusSubscriber interface checkstyleTest (5 files, 9 violations): - Move static imports to top (option=top in checkstyle config) - Fix import group ordering (io before org per groups config) - Remove unused import (assertNull) - Fix VariableDeclarationUsageDistance by moving declarations closer to first usage Fixes: third round of CI failures in PR apache#5260 after javadoc fixes.
checkstyle groups order: org.apache.eventmesh,org.apache,java,javax,org,io,net,junit,com,lombok - Move org.junit.jupiter.* (org group) before io.cloudevents.* (io group) in test files - Separate com.fasterxml and lombok into their own groups with blank lines in A2AGatewayService Fixes: 4th round checkstyle violations in PR apache#5260
Increase TTL from 200ms to 500ms and cleanup interval from 100ms to 250ms to prevent race condition on slow CI runners (macOS). Add assertion messages for better debugging. The test was flaky because Thread.sleep(100) could exceed 100ms on overloaded CI runners, causing the cleanup to expire the card before heartbeat check. Fixes: 5th round CI failure on macOS in PR apache#5260
- A2AMessageTransport.java: add Javadoc for MessageCallback interface - A2AClient.java: remove unused java.util.function.Consumer import - A2AClient.java: fix import order (org.apache.eventmesh, org.apache, java, org, io, com per checkstyle groups) - A2AClient.java: add Javadoc for RequestHandler interface Fixes: 6th round CI failure (protocol-a2a checkstyle) in PR apache#5260
- Move static imports to top (option=top in checkstyle) - Fix alphabetical order: assertFalse before assertNotNull Fixes: 7th round CI failure (protocol-a2a checkstyleTest) in PR apache#5260
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#5259
What's New
A2A Gateway Runtime (eventmesh-runtime)
A2A Protocol Plugin (eventmesh-protocol-a2a)
Examples
Tests (all passing)
Documentation (7 files updated)
Key Engineering Decisions
Fixes #issue_id
Motivation
Explain the content here.
Explain why you want to make the changes and what problem you're trying to solve.
Modifications
Describe the modifications you've done.
Documentation