i am using Spring Boot 2.7 with server.shutdown=graceful
. I have an issue with open SSE connections, as those do not terminate during the graceful shutdown.
I get the following:
2023-01-03 17:50:20.079 INFO 39014 --- [tomcat-shutdown] o.s.b.w.e.tomcat.GracefulShutdown : Graceful shutdown aborted with one or more requests still active
I would like to terminate all the SSE connections during the graceful shutdown, so that the server can stop quicker, and not wait for the 30s timeout for connections that won't ever finish.
I tried using @PreDestroy
on my bean, but it is invoked after the graceful shutdown, and thus doesn't work.
Is there another Spring hook i could use to close the open SSE connections during the graceful shutdown?