[jax-rs-spec users] Re: Server Sent Events

From: Pavel Bucek <>
Date: Wed, 8 Mar 2017 13:17:40 +0100

Hi Friso,

I'm not exactly sure what are you referring to - your code is quite
complex and it could use some cleanup; could you try to summarize your
concern into single code snippet (resource method/...)?

What do you mean by "I do not want to allocate a separate thread for
managing the SseEventSink"? I don't see anything in the API which would
say that you have to do that. SseEventSink instance is guaranteed to be
thread safe, so it can be stored and then used from different threads.

Best regards,

On 08/03/2017 10:32, wrote:
> Hi,
> I read
> which asked for comments here, so here goes:
> 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:
> . The downside of that is that it leaves me with warnings from the
> auto-closable.
> (If you’re interested, usage is on line 258 and 353 (which is called
> from the function starting on line 284) of
> Is my use-case rare? Should I not be doing this with SSE?
> Groeten,
> Friso