Commit 2527428
authored
* [EVENTMESH-xxx] Add A2A Gateway: REST API, SSE streaming, Task lifecycle, 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
* fix: fix Javadoc bad use of '>' in A2AGatewayDemo flow diagram
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 #5260.
* fix: escape '>' in TaskRegistry Javadoc state machine diagram
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 #5260 after first fix.
* fix: resolve all checkstyle violations in A2A module
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 #5260 after javadoc fixes.
* fix: correct import group ordering in A2A module
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 #5260
* fix: stabilize flaky testHeartbeatRefreshesTtl test
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 #5260
* fix: resolve checkstyle violations in protocol-a2a module
- 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 #5260
* fix: static import ordering in A2ATopicFactoryTest
- 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 #5260
1 parent 7cfbede commit 2527428
27 files changed
Lines changed: 6084 additions & 37 deletions
File tree
- docs/a2a-protocol
- eventmesh-examples/src/main/java/org/apache/eventmesh/a2a/demo
- gateway
- eventmesh-protocol-plugin/eventmesh-protocol-a2a
- src
- main/java/org/apache/eventmesh/protocol/a2a
- test/java/org/apache/eventmesh/protocol/a2a
- eventmesh-runtime/src
- main/java/org/apache/eventmesh/runtime/a2a
- test/java/org/apache/eventmesh/runtime/a2a
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
77 | 141 | | |
78 | 142 | | |
79 | 143 | | |
| |||
113 | 177 | | |
114 | 178 | | |
115 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
116 | 192 | | |
117 | 193 | | |
118 | 194 | | |
| |||
149 | 225 | | |
150 | 226 | | |
151 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
152 | 309 | | |
153 | 310 | | |
| 311 | + | |
154 | 312 | | |
155 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
32 | 94 | | |
33 | 95 | | |
34 | 96 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
0 commit comments