Class MessageStreamResourceJaxRs
- java.lang.Object
-
- org.glassfish.jersey.examples.aggregator.MessageStreamResourceJaxRs
-
@Path("message/stream/jaxrs") @Singleton public final class MessageStreamResourceJaxRs extends Object
Resource that aggregates incoming messages and broadcasts them to the registered Server-Sent Even (SSE) client streams.Uses the JAX-RS 2.1 SSE API.
- Author:
- Marek Potociar
- See Also:
MessageStreamResourceJersey
-
-
Constructor Summary
Constructors Constructor Description MessageStreamResourceJaxRs(Sse sse)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgetMessageStream(SseEventSink eventSink)Get the new SSE message stream channel.voidputMessage(Message message)Put a new message to the stream.
-
-
-
Method Detail
-
putMessage
@PUT @Consumes("application/json") public void putMessage(Message message)
Put a new message to the stream. The message will be broadcast to all registered SSE clients.- Parameters:
message- message to be broadcast.
-
getMessageStream
@GET @Produces("text/event-stream") public void getMessageStream(@Context SseEventSink eventSink)
Get the new SSE message stream channel.
-
-