Skip to content

Commit f66ef42

Browse files
kabirclaude
andcommitted
fix: resolve intermittent SSE event delivery failures in JSONRPC transport
The JSONRPC MultiSseSupport was missing flush controls that the REST version already had, causing Vert.x to buffer SSE writes. When events arrived quickly (within milliseconds), all events would accumulate in the write buffer without flushing to the client, resulting in 15-second timeouts in testNonBlockingWithMultipleMessages. Applied the same pattern from REST implementation: - Set write queue max size to 1 to force immediate flush - Add Cache-Control and X-Accel-Buffering headers to prevent buffering - Send initial SSE comment to kickstart the stream This fixes intermittent failures in AbstractA2AServerTest where the server successfully distributed events to child queues but clients never received them. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f537fa6 commit f66ef42

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,17 @@ public void onNext(String sseEvent) {
783783
if (headers.get(CONTENT_TYPE) == null) {
784784
headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS);
785785
}
786+
// Additional SSE headers to prevent buffering
787+
headers.set("Cache-Control", "no-cache");
788+
headers.set("X-Accel-Buffering", "no"); // Disable nginx buffering
786789
response.setChunked(true);
790+
791+
// CRITICAL: Disable write queue max size to prevent buffering
792+
// Vert.x buffers writes by default - we need immediate flushing for SSE
793+
response.setWriteQueueMaxSize(1);
794+
795+
// Send initial SSE comment to kickstart the stream
796+
response.write(": SSE stream started\n\n");
787797
}
788798

789799
// Write SSE-formatted string to response

0 commit comments

Comments
 (0)