Stilts 0.1.0-SNAPSHOT

org.projectodd.stilts.stomplet.helpers
Class DefaultStomplet

java.lang.Object
  extended by org.projectodd.stilts.stomplet.helpers.AbstractStomplet
      extended by org.projectodd.stilts.stomplet.helpers.DefaultStomplet
All Implemented Interfaces:
Stomplet

public class DefaultStomplet
extends AbstractStomplet
implements Stomplet


Constructor Summary
DefaultStomplet()
           
 
Method Summary
 void onMessage(StompMessage message)
          Handle a message sent to a destination matched by this stomplet.
 void onSubscribe(Subscriber subscriber)
          Handle a subscription request.
 void onUnsubscribe(Subscriber subscriber)
          Handle the cancellation of a subscription.
 
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
destroy, initialize
 

Constructor Detail

DefaultStomplet

public DefaultStomplet()
Method Detail

onMessage

public void onMessage(StompMessage message)
               throws StompException
Description copied from interface: Stomplet
Handle a message sent to a destination matched by this stomplet.

In the event the stomplet is servicing multiple destinations, the stomplet may need to inspect the StompMessage for details as to how to handle the incoming message.

If named-segments are present in the applicable routing rule, each named segment is added to the message's header values, prefixed with stomplet..

For instance, the following routing rule:

 ROUTE /queues/:queue_name com.mycorp.MyStomplet
 

Would result in all inbound messages with matching destinations to have a header named stomplet.queue_name added to it, with the value being the matching portion of the destination.

Specified by:
onMessage in interface Stomplet
Parameters:
message - The inbound message.
Throws:
StompException - If an error occurs while processing the message.

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.

Stilts 0.1.0-SNAPSHOT

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