UMDS Java API
6.14
|
Class to receive persisted messages by a topic or wildcard receiver. More...
Inherits com.latencybusters.umds.UMDSReceiverBase.
Public Member Functions | |
UMDSPersistentReceiver (UMDSServerConnection sconn, String topic, boolean iswildcard, UMDSReceiverRecoveryInfoCallback receiverRecoveryInfoCb, Object receiverRecoveryInfoCbArg) throws UMDSException | |
This constructor creates a receiver or wildcard persistent receiver object on a UMDS connection as per iswildcard param. More... | |
void | onMessage (UMDSMessage msg) |
Message Delivery function. This is called to deliver messages to the application. More... | |
void | onEvent (UMDSMessage msg) |
Event Notification function. This function is called when non-data events occur, E.G. Loss reported by the server. More... | |
void | onRequest (UMDSMessage msg) |
Callback for request messages received. This functionality is not implemented for persistence at this time. Do not use. More... | |
final void | close () throws UMDSException |
Close this receiver. More... | |
void | log (int level, String comment) |
Object | getReceiverRecoveryInfoCbArg () |
Protected Attributes | |
UMDSReceiverRecoveryInfoCallback | receiverRecoveryInfoCb = null |
Object | receiverRecoveryInfoCbArg = null |
UMDSServerConnection | server |
String | topic |
Class to receive persisted messages by a topic or wildcard receiver.
There are three callbacks to the user code: persistence information, non-message events, and messages. To use this class, applications typically define their own class derived from this one, providing their own onMessage() and onEvent() functions. UMDS will call those methods asynchronously as needed.
In addition, a persistence recovery information callback is available. Applications define their own callback class derived from the UMDSReceiverRecoveryInfoCallback template. When the UMDS associates a persistent Ultra Messaging source with this client receiver, it invokes the UMDSReceiverRecoveryInfoCallback::setReceiverRecoverySequenceNumber() method to give the application access to persistence information.
For more information, see Using UMDS Persistence.
com.latencybusters.umds.UMDSPersistentReceiver.UMDSPersistentReceiver | ( | UMDSServerConnection | sconn, |
String | topic, | ||
boolean | iswildcard, | ||
UMDSReceiverRecoveryInfoCallback | receiverRecoveryInfoCb, | ||
Object | receiverRecoveryInfoCbArg | ||
) | throws UMDSException |
This constructor creates a receiver or wildcard persistent receiver object on a UMDS connection as per iswildcard param.
sconn | The server connection object this receiver is associated with. This explicitly ties the receiver to a server. |
topic | The topic string to subscribe. |
iswildcard | Indicates this receiver is a wildcard pattern |
receiverRecoveryInfoCb | Optional callback object invoked by UMDS to deliver persistence information by calling the user's UMDSReceiverRecoveryInfoCallback::setReceiverRecoverySequenceNumber() implementation. If this callback is not needed, pass null. |
receiverRecoveryInfoCbArg | Optional arbitrary application object that UMDS will pass to the application's receiverRecoveryInfoCb callback. If not needed, pass null. |
UMDSException |
References com.latencybusters.umds.UMDSPersistentReceiver.onMessage().
final void com.latencybusters.umds.UMDSPersistentReceiver.close | ( | ) | throws UMDSException |
Close this receiver.
This method initiates the close operation, but UMDS will continue to deliver queued messages before the close is completed. When the receiver is fully closed, the UMDSMessage.MSG_TYPE.RECEIVER_DELETE event will be delivered to onEvent().
UMDSException | When the receiver could not be cleanly deleted |
|
inherited |
Log a receiver related message. This API currently does nothing unique, but is provided as an aid to users deriving from the class but may in the future be updated to identify the receiver automatically.
UMDSException | the UMDS exception |
void com.latencybusters.umds.UMDSPersistentReceiver.onEvent | ( | UMDSMessage | msg | ) |
Event Notification function. This function is called when non-data events occur, E.G. Loss reported by the server.
This can be overridden by applications, if desired.
Expected message types:
msg | The message containing the event |
References com.latencybusters.umds.UMDSMessage.MSG_STATUS.CLOSE_PENDING, com.latencybusters.umds.UMDSMessage.MSG_TYPE.DISCONNECT, com.latencybusters.umds.UMDS.LOG_LEVEL.INFO, com.latencybusters.umds.UMDSMessage.MSG_TYPE.LOSS, com.latencybusters.umds.UMDSMessage.MSG_TYPE.RECEIVER_CREATE, com.latencybusters.umds.UMDSMessage.MSG_TYPE.RECEIVER_DELETE, com.latencybusters.umds.UMDSMessage.seqnum, com.latencybusters.umds.UMDSMessage.MSG_TYPE.SERVER_DENIED, com.latencybusters.umds.UMDSMessage.srcidx, com.latencybusters.umds.UMDSMessage.status, com.latencybusters.umds.UMDSMessage.status_str, and com.latencybusters.umds.UMDSMessage.type.
void com.latencybusters.umds.UMDSPersistentReceiver.onMessage | ( | UMDSMessage | msg | ) |
Message Delivery function. This is called to deliver messages to the application.
This must be overridden by applications.
Only data messages will be given to onMessage(). See onEvent() for other event types.
msg | The message containing the received data. |
References com.latencybusters.umds.UMDSMessage.length(), and com.latencybusters.umds.UMDS.LOG_LEVEL.WARN.
Referenced by com.latencybusters.umds.UMDSPersistentReceiver.UMDSPersistentReceiver().
void com.latencybusters.umds.UMDSPersistentReceiver.onRequest | ( | UMDSMessage | msg | ) |
Callback for request messages received. This functionality is not implemented for persistence at this time. Do not use.
msg | The type for request messages is REQUEST. All UMDSMessage interfaces that are valid for DATA messages are also valid for request messages. The requestID is undefined for received requests, as it is a source-side-only correlation ID. |
References com.latencybusters.umds.UMDS.LOG_LEVEL.WARN.
|
protectedinherited |
The UMDS Server Connection associated with this receiver
|
protectedinherited |
This receivers interested topic