|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.crankuptheamps.client.MessageRouter
public class MessageRouter
MessageRouter is used to register and manage a list of handler objects for messages, and then to route messages to those handlers as messages arrive. MessageRouter also "knows" about the meaning of AMPS acks and can use them to automatically clean up routes as acks arrive.
Constructor Summary | |
---|---|
MessageRouter()
|
Method Summary | |
---|---|
void |
addRoute(CommandId commandId_,
MessageHandler messageHandler_,
int requestedAcks_,
int systemAcks_,
boolean isSubscribe_)
Adds a route to self. |
void |
clear()
Removes all routes from self. |
int |
deliverAck(Message ackMessage_,
int ackType_)
Deliver a message that is known already to be an Ack. |
int |
deliverData(Message dataMessage_)
Delivers a data message (not an Ack) to the registered route. |
int |
deliverData(Message dataMessage_,
CommandId commandId_)
Delivers a data message using a specific command ID from the message. |
MessageHandler |
findRoute(CommandId commandId_)
Find and return a route |
boolean |
removeRoute(CommandId commandId_)
Remove a route from self. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MessageRouter()
Method Detail |
---|
public void addRoute(CommandId commandId_, MessageHandler messageHandler_, int requestedAcks_, int systemAcks_, boolean isSubscribe_)
commandId_
- The command, query, or subid used for this route.messageHandler_
- The message handler to route torequestedAcks_
- The actual acks requested from amps for this commandsystemAcks_
- The acks not requested by the end user, but requested by AMPS.
These will not be delivered to the message handler, but are still
processed for auto-removal.isSubscribe_
- True if this route is for an ongoing subscriptionpublic boolean removeRoute(CommandId commandId_)
commandId_
- The route to remove
public MessageHandler findRoute(CommandId commandId_)
commandId_
- The command id for this route
public void clear()
public int deliverAck(Message ackMessage_, int ackType_) throws Exception
ackMessage_
- The Message to deliver.ackType_
- The ack type from that message.
Any
- exception from user message handlers.
Exception
public int deliverData(Message dataMessage_) throws Exception
dataMessage_
- The non-ack message to deliver.
Exception
- Any exception thrown by the user message handler.public int deliverData(Message dataMessage_, CommandId commandId_) throws Exception
dataMessage_
- The message to deliver.commandId_
- The command ID which will be used to lookup the delivery route
Exception
- Any exception returned thrown by the message handler.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |