Skip to content

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

@Devenvaruv

Description

@Devenvaruv

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

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions