a2aproject / a2aproject/a2a-samples

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

Abierto
#358 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Jupyter Notebook
Estrellas
1.8k
Forks
751
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.