You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "Lyin-OTTF (via GitHub)" <gi...@apache.org> on 2026/10/20 13:23:04 UTC
[PR] [ISSUE #5226] Fix A2A usage guide: replace non-public A2AProtocolTransportObject with CloudEvent publish (eventmesh)
Lyin-OTTF opened a new pull request, #5430:
URL: https://github.com/apache/eventmesh/pull/5430
Fixes #5226.
The client/server examples in `docs/a2a-protocol/` call `new A2AProtocolTransportObject(...)`, but that type is not part of the public SDK: in the code it only exists as the private inner class `SimpleA2AProtocolTransportObject` inside `EnhancedA2AProtocolAdaptor`, so the snippet cannot compile as written.
This PR replaces the examples with the path used by the shipped example `eventmesh-examples/src/main/java/org/apache/eventmesh/a2a/demo/mcp/McpCaller.java` and by section 5.1.3 of `docs/feature/a2a.md`:
- client: wrap the JSON-RPC payload in a CloudEvent whose type is `org.apache.eventmesh.a2a.tools.call.req` and which carries the `protocol=A2A` extension, then `producer.publish(event)`;
- server: publish the JSON-RPC response the same way with type `org.apache.eventmesh.a2a.common.response`, and document the ingress mapping the adaptor performs (`mcptype=response`, `collaborationid=<request id>`, per `EnhancedA2AProtocolAdaptor`).
Also fixes the broken Java string concatenation in the Chinese server example and adds a note that `A2AProtocolTransportObject` is an internal adaptor type.
--
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: dev-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org
Re: [PR] [ISSUE #5226] Fix A2A usage guide: replace non-public A2AProtocolTransportObject with CloudEvent publish (eventmesh)
Posted by "Lyin-OTTF (via GitHub)" <gi...@apache.org>.
Lyin-OTTF commented on PR #5430:
URL: https://github.com/apache/eventmesh/pull/5430#issuecomment-6306921818
develop has the same problem: docs/feature/a2a.md lines 754 and 779 still call `new A2AProtocolTransportObject(mcpRequest)` / `(mcpResponse)`, which is the private inner class `SimpleA2AProtocolTransportObject` in `EnhancedA2AProtocolAdaptor` and cannot compile as written. The a2a-protocol/ directory only exists on master, so this PR fixes the master copy.
I can either retarget this PR to develop and fix docs/feature/a2a.md there instead, or keep this one for master and open a second PR against develop for a2a.md. Which do you prefer?
I'll also go through the Copilot suggestions on the missing `mcptype` extensions and `getDataContentType()` in the builders — will push a follow-up commit once I've verified them against McpCaller.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #5226] Fix A2A usage guide: replace non-public A2AProtocolTransportObject with CloudEvent publish (eventmesh)
Posted by "qqeasonchen (via GitHub)" <gi...@apache.org>.
qqeasonchen commented on PR #5430:
URL: https://github.com/apache/eventmesh/pull/5430#issuecomment-6305846593
@Lyin-OTTF what about develop branch?
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #5226] Fix A2A usage guide: replace non-public A2AProtocolTransportObject with CloudEvent publish (eventmesh)
Posted by "Lyin-OTTF (via GitHub)" <gi...@apache.org>.
Lyin-OTTF commented on PR #5430:
URL: https://github.com/apache/eventmesh/pull/5430#issuecomment-6308814032
Pushed a follow-up commit for both Copilot threads (82253de).
Both points check out against the code:
- `McpProvider.handleCallback` dispatches on the `mcptype` extension, and `mcptype`, `a2amethod`, `targetagent` and `collaborationid` are only filled in by `EnhancedA2AProtocolAdaptor` while it converts JSON-RPC to a CloudEvent. Code that publishes the CloudEvent itself never goes through that conversion, so it has to set them. The examples now do, on both the request and the response side.
- `CloudEventProducer.buildCommonPostParam` calls `EventFormatProvider.resolveFormat(cloudEvent.getDataContentType())` and throws when that returns null. The examples now set `application/cloudevents+json`, the same value as `ExampleConstants.CLOUDEVENT_CONTENT_TYPE` used by `McpCaller`, and the subject carries the topic on both builders.
The sentence claiming the adaptor adds `mcptype=response` and `collaborationid` on ingress only holds for the JSON-RPC path, so I replaced it with a note that direct publishers have to set these extensions themselves.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #5226] Fix A2A usage guide: replace non-public A2AProtocolTransportObject with CloudEvent publish (eventmesh)
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #5430:
URL: https://github.com/apache/eventmesh/pull/5430#discussion_r4332243302
##########
docs/a2a-protocol/README_EN.md:
##########
@@ -111,21 +111,63 @@ To support the MCP Request/Response model within an event-driven architecture, A
### 1. Initiate Call (Client)
```java
-// 1. Construct MCP Request JSON
-String mcpRequest = "{" +
- "\"jsonrpc\": \"2.0\"," +
- "\"method\": \"tools/call\"," +
- "\"params\": { \"name\": \"weather\", \"_agentId\": \"weather-agent\" }," +
- "\"id\": \"req-001\"" +
- "}";
-
-// 2. Send via EventMesh SDK
-eventMeshProducer.publish(new A2AProtocolTransportObject(mcpRequest));
+// 1. Construct the MCP request payload (JSON-RPC 2.0)
+Map<String, Object> params = new HashMap<>();
+params.put("name", "weather");
+params.put("_agentId", "weather-agent"); // routing hint
+
+Map<String, Object> request = new HashMap<>();
+request.put("jsonrpc", "2.0");
+request.put("method", "tools/call");
+request.put("params", params);
+request.put("id", "req-001");
+
+// 2. Wrap it as a CloudEvent. The "org.apache.eventmesh.a2a." type prefix
+// together with the protocol=A2A extension triggers the A2A adaptor.
Review Comment:
The HTTP SDK selects CloudEvents ingress through its transport header, not A2A ingress through these event attributes. That path deserializes the CloudEvent without converting its JSON-RPC data. Consequently the request lacks `mcptype=request` (so `McpProvider.handleCallback` ignores it), and the server response does not acquire the `mcptype` or `collaborationid` promised below. In both READMEs, explicitly set the request extensions `mcptype=request`, `a2amethod=tools/call`, and `targetagent=weather-agent`, and the response extensions `mcptype=response` and `collaborationid=<request id>`. Correct both explanations to distinguish direct CloudEvent publication from raw JSON-RPC conversion by `EnhancedA2AProtocolAdaptor`.
##########
docs/a2a-protocol/README_EN.md:
##########
@@ -111,21 +111,63 @@ To support the MCP Request/Response model within an event-driven architecture, A
### 1. Initiate Call (Client)
```java
-// 1. Construct MCP Request JSON
-String mcpRequest = "{" +
- "\"jsonrpc\": \"2.0\"," +
- "\"method\": \"tools/call\"," +
- "\"params\": { \"name\": \"weather\", \"_agentId\": \"weather-agent\" }," +
- "\"id\": \"req-001\"" +
- "}";
-
-// 2. Send via EventMesh SDK
-eventMeshProducer.publish(new A2AProtocolTransportObject(mcpRequest));
+// 1. Construct the MCP request payload (JSON-RPC 2.0)
+Map<String, Object> params = new HashMap<>();
+params.put("name", "weather");
+params.put("_agentId", "weather-agent"); // routing hint
+
+Map<String, Object> request = new HashMap<>();
+request.put("jsonrpc", "2.0");
+request.put("method", "tools/call");
+request.put("params", params);
+request.put("id", "req-001");
+
+// 2. Wrap it as a CloudEvent. The "org.apache.eventmesh.a2a." type prefix
+// together with the protocol=A2A extension triggers the A2A adaptor.
+CloudEvent event = CloudEventBuilder.v1()
+ .withId("req-001")
+ .withSource(URI.create("mcp-client"))
+ .withType("org.apache.eventmesh.a2a.tools.call.req")
Review Comment:
Both client and server builders in both READMEs omit fields required by the HTTP SDK used in `McpCaller`. `CloudEventProducer.buildCommonPostParam` selects its serializer from `getDataContentType()`, so publication fails when it is unset. The runtime also rejects a missing `subject`; `type` does not select the destination topic. Add `application/cloudevents+json` and the subscribed topic to all four builders. The suggestion fixes this client builder; use the client's subscribed response topic for the server builders.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #5226] Fix A2A usage guide: replace non-public A2AProtocolTransportObject with CloudEvent publish (eventmesh)
Posted by "Lyin-OTTF (via GitHub)" <gi...@apache.org>.
Lyin-OTTF commented on PR #5430:
URL: https://github.com/apache/eventmesh/pull/5430#issuecomment-6320892398
The three workflows (Continuous Integration, License Check, Code Scanning) report "No jobs were run" on this PR and on #5431. None of them has path filters in `.github/workflows` (ci.yml triggers on `pull_request` for all branches), so this looks like the first-time-contributor approval gate rather than a skipped run.
Could someone with write access approve the runs? Everything else is in place here: three approvals, and the Copilot findings are addressed in 82253de.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #5226] Fix A2A usage guide: replace non-public A2AProtocolTransportObject with CloudEvent publish (eventmesh)
Posted by "Lyin-OTTF (via GitHub)" <gi...@apache.org>.
Lyin-OTTF commented on PR #5430:
URL: https://github.com/apache/eventmesh/pull/5430#issuecomment-6344363676
Thanks for the approvals. One heads-up: the workflows still have not run on this PR. The Actions runs are waiting on first-contributor approval, so there is no CI result to merge against yet. Could someone approve the workflow runs when convenient? The change is docs-only (two files under docs/a2a-protocol/), so I do not expect it to affect any build.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org