qqeasonchen opened a new pull request, #5406: URL: https://github.com/apache/eventmesh/pull/5406
Fixes #5405 ### What The A2A gateway was component-complete but never wired for production. This PR wires it into the main process and hardens the plane: **1. Gateway in the main process (opt-in)** - `EventMeshApplication.withA2aGateway(...)` + `-Deventmesh.a2a.enabled=true` (port `10108` default, `EVENTMESH_A2A_*` envs in `bin/start.sh`) - Wired onto the REAL transport: `EventMeshA2ATransport` bridged onto `UniIngressService` (CloudEvents-over-MQ) — previously this class existed unused - `TaskExpirer` reaper wired with expiry metrics; graceful shutdown included **2. `RocksDBTaskStore`** — local durable task store under `<data>/a2a-tasks` (same layout as offsets/delivery-state), wire-format compatible with the MetaBacked v1 envelope (contextId appended as a 10th field older readers ignore). Default without Meta; `-Deventmesh.a2a.taskstore=meta` selects the cluster-shared store. **3. Bearer-token auth** — `-Deventmesh.a2a.token` (constant-time compare, same pattern as the admin guard #5364); without a token the gateway is open (dev mode, logged at boot). **4. A2A metrics** — submitted/completed/failed/canceled/expired counters + active-task gauge via `A2AMetrics`, surfaced in `/admin/metrics` JSON and the `/metrics` Prometheus scrape. **5. Traffic-port guidance (#5225 class confusion)** — a JSON-RPC body posted to `/events/publish` returns a 400 pointing at the A2A gateway endpoints instead of an opaque CloudEvent transform error. **6. `contextId` passthrough** — optional conversation linkage on task submit, persisted in `TaskRecord`, echoed in snapshots. **7. Bug fix found by the new wiring test:** `A2AGatewayHttpHandler` was missing `@Sharable` — the second HTTP connection on the gateway crashed with `ChannelPipelineException` (the gateway could only ever serve ONE connection; all existing tests used a single request). Also `A2AGatewayServer.getPort()` now resolves the auto-selected port (`0`). ### Testing (local, full gradle gates) - `RocksDBTaskStoreTest` 7/7: CRUD round-trip with opaque payloads, duplicate-id rejection, epoch CAS rejection, contextId persistence through status updates, expiry sweep, reopen durability - `A2AGatewayWiringTest` 3/3: main-process boot + health, token 401/401/200, contextId through the REST round-trip into the durable store - Existing suite green: `A2AGatewaySmokeTest`, `A2AGatewayFailureModeTest`, `A2AGatewayServiceTest`, `TaskExpirerTest` - checkstyleMain + checkstyleTest: 0 violations -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
