a2aproject / a2aproject/a2a-samples

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

Đang mở
#358 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Jupyter Notebook
Star
1.8k
Fork
751
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.