Skip to content

Add SSE Support to RestClient #35164

Description

@asaikali

In Spring WebClient is the only supported way to consume SSE streams. However, using WebClient introduce a reactive streams increasing application complexity.

Ideally RestClient can support the consumption of SSE streams allowing developers to keep codebases simple.

Spring offers reactive and non-reactive facilities for producing SSE events. Adding the ability to consume SSE streams in a reactive and non-reactive ways bring the server side and client side experience to parity.

Activity

  1. added
    in: webIssues in web modules (web, webmvc, webflux, websocket)
    on Jul 7, 2025
  2. tzolov commented on Jul 7, 2025

    @tzolov

    I believe this is related: #34290

  3. added this to the 7.x milestone on Oct 3, 2025
  4. rstoyanchev commented on Oct 3, 2025

    @rstoyanchev
    Contributor

    Historically RestTemplate exposed low level streaming via InputStream and OutputStream. For WebClient, with Reactive Streams (error/completion/cancel/demand signals) and a functional, java.util.stream-like API, it was natural natural to provide higher level streaming. RestClient picks up from where RestTemplate was.

    How to consume an SSE stream is a key question. Historically, an API of this kind is callback-based to avoid blocking. In the JDK, the HttpClient has HttpResponse.BodyHandler (essentially Reactive Streams Flow.Subscriber) including one that splits the response by line. We need the Loom friendly equivalent.

    In modern Java with Loom, it's natural to use a pull-style API that blocks, and integrates well with Structured Concurrency for responsiveness to cancellation. A basic version with rendezvous hand-off is straight-forward enough, but a more advanced version that supports prefetching raises plenty of questions. An even more advanced, functional API, is even more ambitious.

    There is currently nothing in the JDK for this, and it's not going to come soon (e.g. see Structured Concurrency [JEP 505](https://openjdk.org/jeps/505, which lists "sharing streams of data among threads" as a non-goal). We need to explore alternatives in the mean time.

  5. pro-peller commented on Jan 28, 2026

    @pro-peller

    I am very upset that there is no SSE support in SpringBoot, my current projects do not allow updating SpringBoot 4, so the upgrade process has stopped. Please add your work with SSE.

  6. bclozel commented on Jan 28, 2026

    @bclozel
    Member

    @pro-peller I don't understand the link with Spring Boot 4. Why can't you upgrade to Spring Boot 4 and why is that about SSE support in RestClient?

  7. axma331 commented on Jan 28, 2026

    @axma331

    Spring Boot 4 lacks SSE support, blocking our upgrade path. Our applications depend on Server-Sent Events, so we can't migrate until this feature is available. Please add SSE support to Spring Boot 4

  8. bclozel commented on Jan 28, 2026

    @bclozel
    Member

    @axma331 I think there is a misunderstanding here. Spring Boot 4 does support SSE and all features that are available in Spring Boot 3. So upgrading is definitely possible for your apps.

    This issue is about a brand new feature that never existed so far. We are exploring different approaches because the JDK is missing infrastructure for streaming support.

    So again: there is no blocker for the Spring Boot 4 upgrade. I'm not sure what lead you to think that.

  9. modified the milestones: 7.x, 7.1.x on Jan 30, 2026
  10. added a commit that references this issue on Sep 19, 2026
    e5ecc2a
  11. modified the milestones: 7.1.x, 7.x on Sep 19, 2026
  12. hojooo commented on Oct 8, 2026

    @hojooo

    @bclozel following #37301, I’ve been experimenting with a blocking pull-style API that lets callers read SSE events one at a time and close the stream when done.

    Would a focused set of tests and reproducers be useful for your ongoing experiments?

  13. bclozel commented on Oct 8, 2026

    @bclozel
    Member

    @hojooo thanks for the proposal. We've got an advanced prototype and we're experimenting with it. We'll communicate more broadly when it's ready to get community feedback. I'll mark the issue as blocked so that the community doesn't spend time on this.

  14. added
    status: blockedAn issue that's blocked on an external project change
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: blockedAn issue that's blocked on an external project changetype: enhancementA general enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions