1

I have an spring boot 3 back-end application, which does serve also some Flux (SSE, https://www.w3schools.com/html/html5_serversentevents.asp ) event streams. i.e.:

@RequestMapping(path = "/notifications", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<ServerSentEvent<OnlineNotificationEvent>> notificationsSse(HttpServletRequest request) {
    // implementation ...
}

I have set up in application.yaml that graceful shutdown should happen:

server:
  port: 9099
  shutdown: graceful

When I open frontend (which opens given sse endpoint), shutdown is not gracefull and it is (I think) waiting for sse endpoint connection to close, till shutdown timeout.

What is the best way to close (finish) sse all opened connections when shutdown request comes? Perhaps same can be applied to websocket connections also.

Lubo
  • 1,621
  • 14
  • 33
  • I have found out, that one of my heartbeat to sse (due proxy/firewall closing connection without data within 30 seconds) keeps connection open during close. I have not found nice solution to this problem yet. – Lubo May 31 '23 at 07:49

0 Answers0