a2aproject / a2aproject/a2a-samples

Java sample: use message/stream for streaming + fix SSE parsing

未关闭
#358 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
1.8k
派生
751
PR 合并指标
30 天内没有已合并 PR

描述

### Is your feature request related to a problem? Please describe.

I’ve been running the Java sample and noticed two things around streaming:

The streaming RPC still uses message/send in the JSON-RPC body when calling the /a2a/stream endpoint. As of A2A v0.3.0, streaming is invoked via the JSON-RPC method "message/stream"

The client parses SSE a line at a time and tries to JSON-decode each line, which breaks when the server sends event: lines or multi-line data: frames.

How to reproduce:

Start the server (../mvnw spring-boot:run) and run the client example (../mvnw exec:java -Dexec.mainClass="com.google.a2a.client.A2AClientExample").

The streaming section intermittently fails with a “failed to parse streaming response” error, depending on the exact payload.

### Describe the solution you'd like

Client: send message/stream to /a2a/stream, and change the SSE parser to:

ignore non-data: lines,

strip the data: prefix,

parse once per SSE event (on blank line).

Server: require message/stream on /a2a/stream and send POJOs in emitter.send(... .data(obj)) so each SSE data: is clean JSON.

Non-streaming calls (/a2a + message/send, tasks/get, tasks/cancel) stay the same.

### Describe alternatives you've considered

Keep message/send on /a2a/stream: simple and backward-compatible, but out of spec for v0.3.0 and potentially confusing in the long term.

### Additional context

_No response_

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。