a2aproject / a2aproject/a2a-samples

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

Ouverte
#358 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Jupyter Notebook
Étoiles
1.8k
Forks
751
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.