org.glassfish.jersey.examples.aggregator
Class MessageStreamResource

java.lang.Object
  extended by org.glassfish.jersey.examples.aggregator.MessageStreamResource

@Path(value="message/stream")
public class MessageStreamResource
extends java.lang.Object

Resource that aggregates incoming messages and broadcasts them to the registered Server-Sent Even (SSE) client streams.

Author:
Marek Potociar (marek.potociar at oracle.com)

Constructor Summary
MessageStreamResource()
           
 
Method Summary
 EventOutput getMessageStream()
          Get the new SSE message stream channel.
 void putMessage(Message message)
          Put a new message to the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageStreamResource

public MessageStreamResource()
Method Detail

putMessage

@PUT
@Consumes(value="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(value="text/event-stream")
public EventOutput getMessageStream()
Get the new SSE message stream channel.

Returns:
new SSE message stream channel.


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.