|
Stilts 0.1.0-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Stomplet
Defines methods that all Stomplets must implement.
A Stomplet is a small Java class that performs two functions related to asynchronous message processing:
A single Stomplet may be configured to services multiple destinations based upon routing rules.
http://stilts.projectodd.org/stomplet/
Method Summary | |
---|---|
void |
destroy()
Clean up any resources allocated by the stomplet before removing it from the container. |
void |
initialize(StompletConfig config)
Initialize the Stomplet in its container environment |
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. |
Method Detail |
---|
void initialize(StompletConfig config) throws StompException
config
- The configuration for the stomplet.
StompException
- If an error occurs during initialization.void destroy() throws StompException
StompException
- If an error occurs during destruction.void onMessage(StompMessage message) throws StompException
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.
message
- The inbound message.
StompException
- If an error occurs while processing the message.void onSubscribe(Subscriber subscriber) throws StompException
For subscription requests matching destinations mapped to this
stomplet, the 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.
subscriber
- The live subscriber making the request.
StompException
- If an error occurs processing the subscription request.void onUnsubscribe(Subscriber subscriber) throws StompException
When a client explicitly cancels a subscription, or disconnects,
the stomplet is notified through onUnsubscribe(Subscriber)
,
having the same Subscriber
instance passed to it.
subscriber
- The subscriber cancelling the subscription.
StompException
- If an error occurs processing the subscription cancellation request.
|
Stilts 0.1.0-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |