Stilts 0.1.0-SNAPSHOT

org.projectodd.stilts.stomplet.simple
Class SimpleSubscribableStomplet

java.lang.Object
  extended by org.projectodd.stilts.stomplet.helpers.AbstractStomplet
      extended by org.projectodd.stilts.stomplet.simple.SimpleSubscribableStomplet
All Implemented Interfaces:
MessageSink, Stomplet
Direct Known Subclasses:
SimpleQueueStomplet, SimpleTopicStomplet

public abstract class SimpleSubscribableStomplet
extends AbstractStomplet
implements MessageSink


Constructor Summary
SimpleSubscribableStomplet()
           
 
Method Summary
 void onSubscribe(Subscriber subscriber)
          Handle a subscription request.
 void onUnsubscribe(Subscriber subscriber)
          Handle the cancellation of a subscription.
 void send(StompMessage message)
           
protected  void sendToAllSubscribers(StompMessage message)
           
protected  void sendToOneSubscriber(StompMessage message)
           
 
Methods inherited from class org.projectodd.stilts.stomplet.helpers.AbstractStomplet
destroy, getStompletConfig, initialize, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.projectodd.stilts.stomplet.Stomplet
onMessage
 

Constructor Detail

SimpleSubscribableStomplet

public SimpleSubscribableStomplet()
Method Detail

send

public void send(StompMessage message)
          throws StompException
Specified by:
send in interface MessageSink
Throws:
StompException

onSubscribe

public void onSubscribe(Subscriber subscriber)
                 throws StompException
Description copied from interface: Stomplet
Handle a subscription request.

For subscription requests matching destinations mapped to this stomplet, the Stomplet.onSubscribe(Subscriber) method will be invoked with a Subscriber object. If the stomplet chooses to allow the subscription, it may route further messages to the Subscriber to satisfy the subscription.

If it chooses to deny the subscription request (for any reason), throwing a StompException is appropriate.

Specified by:
onSubscribe in interface Stomplet
Parameters:
subscriber - The live subscriber making the request.
Throws:
StompException - If an error occurs processing the subscription request.

onUnsubscribe

public void onUnsubscribe(Subscriber subscriber)
                   throws StompException
Description copied from interface: Stomplet
Handle the cancellation of a subscription.

When a client explicitly cancels a subscription, or disconnects, the stomplet is notified through Stomplet.onUnsubscribe(Subscriber), having the same Subscriber instance passed to it.

Specified by:
onUnsubscribe in interface Stomplet
Parameters:
subscriber - The subscriber cancelling the subscription.
Throws:
StompException - If an error occurs processing the subscription cancellation request.

sendToAllSubscribers

protected void sendToAllSubscribers(StompMessage message)
                             throws StompException
Throws:
StompException

sendToOneSubscriber

protected void sendToOneSubscriber(StompMessage message)
                            throws StompException
Throws:
StompException

Stilts 0.1.0-SNAPSHOT

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.