I’ve used SSE a couple of times now and I notice that my use case usually is different from what I see in most examples. The examples usually have an action that takes a lot of work to complete.
My use case is normally that a request is started and it kicks off another process outside my application. The response sits there and waits for that process to complete. Some trigger, usually an incoming request, in my application will find the response and send an event when needed. So I do not want to allocate a separate thread for managing the SseEventSink. Rather I usually end up with something like this: https://github.com/digital-me/op-sdk-spi-impl/blob/master/src/main/java/nl/qiy/oic/op/qiy/ServerSentEventStreams.java . The downside of that is that it leaves me with warnings from the auto-closable.