AMPS C# Client  5.3.3.4
AMPS C# Client for .NET
AMPS.Client.MessageRouter Class Reference

Public Member Functions

void addRoute (CommandId commandId_, MessageHandler messageHandler_, Message.AckTypes requestedAcks_, Message.AckTypes systemAcks_, bool isSubscribe_)
 
bool removeRoute (CommandId commandId_)
 
bool hasRoute (CommandId commandId_)
 
MessageHandler findRoute (CommandId commandId_)
 
void clear ()
 
void unsubscribeAll ()
 
int deliverAck (Message ackMessage_, Message.AckTypes ackType_)
 
int deliverData (Message dataMessage_)
 
int deliverData (Message dataMessage_, CommandId commandId_)
 

Detailed Description

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.

Member Function Documentation

◆ addRoute()

void AMPS.Client.MessageRouter.addRoute ( CommandId  commandId_,
MessageHandler  messageHandler_,
Message.AckTypes  requestedAcks_,
Message.AckTypes  systemAcks_,
bool  isSubscribe_ 
)
inline

Adds a route to self.

Parameters
commandId_The command, query, or subid used for this route.
messageHandler_The message handler to route to
requestedAcks_The acks requested by the user for this command
systemAcks_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 subscription

◆ clear()

void AMPS.Client.MessageRouter.clear ( )
inline

Removes all routes from self.

◆ deliverAck()

int AMPS.Client.MessageRouter.deliverAck ( Message  ackMessage_,
Message.AckTypes  ackType_ 
)
inline

Deliver a message that is known already to be an Ack. Coordinates the removal of routes based on the ack received and the original message type.

Parameters
ackMessage_The Message to deliver.
ackType_The ack type from that message.
Returns
The number of message deliveries that occurred
Exceptions
Anyexception from user message handlers.

◆ deliverData() [1/2]

int AMPS.Client.MessageRouter.deliverData ( Message  dataMessage_)
inline

Delivers a data message (not an Ack) to the registered route. Uses the commandID, subID, and queryID to deliver find a route and deliver to the first one found. This method is optimized for speed and does not attempt to examine ack types for removal of routes.

Parameters
dataMessage_The non-ack message to deliver.
Returns
The number of deliveries performed
Exceptions
ExceptionAny exception thrown by the user message handler.

◆ deliverData() [2/2]

int AMPS.Client.MessageRouter.deliverData ( Message  dataMessage_,
CommandId  commandId_ 
)
inline

Delivers a data message using a specific command ID from the message. Optimized for speed and does not attempt to examine the message for auto-removal of routes

Parameters
dataMessage_The message to deliver.
commandId_The command ID which will be used to lookup the delivery route
Returns
The number of deliveries performed
Exceptions
ExceptionAny exception returned thrown by the message handler.

◆ findRoute()

MessageHandler AMPS.Client.MessageRouter.findRoute ( CommandId  commandId_)
inline

Find and return a route

Parameters
commandId_The command id for this route
Returns
The MessageHandler registered for this route, or null if none is registered.

◆ hasRoute()

bool AMPS.Client.MessageRouter.hasRoute ( CommandId  commandId_)
inline

Return if a route exists

Parameters
commandId_The command id for this route
Returns
Whether or not the route exists.

◆ removeRoute()

bool AMPS.Client.MessageRouter.removeRoute ( CommandId  commandId_)
inline

Remove a route from self.

Parameters
commandId_The route to remove
Returns
true if the route was removed.

◆ unsubscribeAll()

void AMPS.Client.MessageRouter.unsubscribeAll ( )
inline

Removes all subscriptions from self.


The documentation for this class was generated from the following file: