users@jax-rs-spec.java.net

[jax-rs-spec users] Server Sent Events

From: <vrolijken_at_yahoo.com>
Date: Wed, 8 Mar 2017 10:32:54 +0100

Hi,

I read https://blogs.oracle.com/PavelBucek/entry/jax_rs_2_1_server 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: 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.

(If you’re interested, usage is on line 258 and 353 (which is called from the function starting on line 284) of https://github.com/digital-me/op-sdk-spi-impl/blob/master/src/main/java/nl/qiy/oic/op/qiy/QiyAuthorizationFlow.java)

Is my use-case rare? Should I not be doing this with SSE?

Groeten,

Friso