UM Java API
6.16.1
|
Encapsulates all LBM messages.
Messages are delivered via the receiver callback. It is possible to retain a message for further processing after the receiver callback returns by calling promote() and saving the message. The application must call dispose() for each and every message when processing is completed. See Java Message Reception.
Access message data via dataBuffer() and dataLength() to preserve "Zero Object Delivery" (ZOD). See Zero Object Delivery.
For older, object-based delivery (non-ZOD), you may access message data via data(), which creates a byte array object that contains the message data. This method has lower performance.
LBMApplicationHeaderChain com.latencybusters.lbm.LBMMessage.applicationHeaderChain | ( | ) | throws LBMException |
Get the application header chain, if any, associated with this message.
LBMEInvalException | if the message contains no application header data, LBMException if another error occurs. |
LBMMessageChannelInfo com.latencybusters.lbm.LBMMessage.channelInfo | ( | ) |
Object containing channel information included with the message.
byte [] com.latencybusters.lbm.LBMMessage.data | ( | ) |
Message data.
Referenced by com.latencybusters.lbm.LBMMessage.dataString().
ByteBuffer com.latencybusters.lbm.LBMMessage.dataBuffer | ( | ) |
Message data as a direct ByteBuffer. For ZOD, use in conjunction with dataLength() to determine how many bytes in the buffer are actually valid, since buffers are generally larger than actual message data. Message data starts at position 0.
If this message has been promoted, the returned byte buffer will have a backing array (non-direct).
If this message was delivered via SMX, this method will copy the message data from the transport into a ByteBuffer allocated with a backing array (non-direct). For more information on getting SMX message data, see getMessagesBuffer().
References com.latencybusters.lbm.LBM.MSG_DATA.
Referenced by com.latencybusters.lbm.LBMContext.allocTopic(), com.latencybusters.lbm.LBMMessage.getMessagesBuffer(), and com.latencybusters.lbm.LBMRequest.removeResponseCallback().
long com.latencybusters.lbm.LBMMessage.dataLength | ( | ) |
Message data length. For ZOD, use this in conjunction with dataBuffer().
String com.latencybusters.lbm.LBMMessage.dataString | ( | ) |
Message string data.
References com.latencybusters.lbm.LBMMessage.data().
UMEDeregistrationCompleteInfo com.latencybusters.lbm.LBMMessage.deregistrationCompleteInfo | ( | ) |
Get an extended registration complete info object from the message (only for LBM#MSG_UME_DEREGISTRATION_COMPLETE_EX messages).
UMEDeregistrationSuccessInfo com.latencybusters.lbm.LBMMessage.deregistrationSuccessInfo | ( | ) |
Get an extended deregistration success info object from the message (only for LBM#MSG_UME_DEREGISTRATION_SUCCESS_EX messages).
void com.latencybusters.lbm.LBMMessage.dispose | ( | ) |
Dispose of memory associated with this message. Every received message must be disposed after processing is complete. See Java Message Reception.
If this message is delivered from a persistent receiver, deleting the message might signal consumption of the message, depending on the use case. See Persistence Message Consumption for a full explanation of consumption acknowledgements.
UMEMessageAck com.latencybusters.lbm.LBMMessage.extractUMEAck | ( | ) | throws LBMException |
Retrieves the ack structure from a UME message.
LBMException | if the message has already been disposed, ACK'd, or was not a UME message |
References com.latencybusters.lbm.LBM.EINVAL.
long com.latencybusters.lbm.LBMMessage.firstFragmentSequenceNumber | ( | ) |
LBM sequence number of the first fragment of the current message
int com.latencybusters.lbm.LBMMessage.flags | ( | ) |
long com.latencybusters.lbm.LBMMessage.fragmentOffset | ( | ) |
Byte offset of the current fragment within the associated message.
ByteBuffer com.latencybusters.lbm.LBMMessage.getMessagesBuffer | ( | ) |
Return a DirectByteBuffer view of the entire transport if this message has not been promoted. The buffer has its position and limit values set to where the message data begins and ends. Only this portion of the buffer is valid for this message. The purpose is to provide zero copy access to the message data. This is different than dataBuffer() which has message data always starting at position 0. If dataBuffer() is called on an smx transport message, the message data is copied from the transport into another buffer to preserve these semantics.
If the application has called promote() on this message, the view of the transport is no longer valid and the data has been copied. In this case, this method will return the same thing as dataBuffer().
Only LBT-SMX transports currently support this method. The return value will be null If this message did not come from an LBT-SMX transport or has no message data.
References com.latencybusters.lbm.LBMMessage.dataBuffer(), com.latencybusters.lbm.LBM.MSG_DATA, and com.latencybusters.lbm.LBMMessage.source().
void com.latencybusters.lbm.LBMMessage.getSerializedResponse | ( | LBMSerializedResponse | serializedResponse | ) | throws LBMException |
Gets the serialized response information from a message so it can be sent to and used by another application to respond.
LBMException | if there were problems getting the serialized response information or there was no response information in the message. |
References com.latencybusters.lbm.LBM.EINVAL.
boolean com.latencybusters.lbm.LBMMessage.hasApplicationHeaderChain | ( | ) |
Check to see if this message contains any application header chain data.
long com.latencybusters.lbm.LBMMessage.hfSequenceNumber | ( | ) |
Get the hot failover sequence number as a long. Since Java does not have unsigned integers this will return the signed long value of either the 32 or 64 bit hot-failover sequence number as specified by LBMMessage.flags(). 64 bit sequence numbers can appear negative and should be handled accordingly.
References com.latencybusters.lbm.LBM.MSG_FLAG_HF_32, and com.latencybusters.lbm.LBM.MSG_FLAG_HF_64.
Referenced by com.latencybusters.lbm.LBMMessage.hfSequenceNumberBigInt().
BigInteger com.latencybusters.lbm.LBMMessage.hfSequenceNumberBigInt | ( | ) |
Get the hot failover sequence number as a BigInteger. Since Java does not have unsigned integers, this is provided to ensure all possible hot failover sequence numbers are given with a positive value. This method is a convenience when using 64 bit sequence numbers, and simply interprets the long value as if it were unsigned.
References com.latencybusters.lbm.LBMMessage.hfSequenceNumber().
long com.latencybusters.lbm.LBMMessage.hrTimestampNanoseconds | ( | ) |
Nanoseconds portion of the high resolution timestamp indicating when the message was received.
References com.latencybusters.lbm.LBM.EINVAL.
long com.latencybusters.lbm.LBMMessage.hrTimestampSeconds | ( | ) |
Seconds portion of the high resolution timestamp indicating when the message was received.
boolean com.latencybusters.lbm.LBMMessage.isFragment | ( | ) |
Determine if the current message is a single fragment of a larger, multi-fragment message.
Note that this method will not return true unless:
boolean com.latencybusters.lbm.LBMMessage.isFromGateway | ( | ) |
Whether or not the message arrived via a gateway.
long com.latencybusters.lbm.LBMMessage.originalSequenceNumber | ( | ) |
Original sequence number (if the message arrived via a gateway).
String com.latencybusters.lbm.LBMMessage.originalSource | ( | ) |
Original message source (if the message arrived via a gateway).
char [] com.latencybusters.lbm.LBMMessage.originalSourceAsCharArray | ( | ) |
Original message source (if the message arrived via a gateway) as char array.
long com.latencybusters.lbm.LBMMessage.osqn | ( | ) |
Retrieve the message original sequence number set by the UM library.
LBMMessage com.latencybusters.lbm.LBMMessage.promote | ( | ) |
Inform UM that the application is going to retain ownership of a UM message object after the receiver callback returns.
This function should be called from inside a receiver callback function to prevent UM from automatically deleting the message when the callback function returns. This allows the message to be passed to a different part of the application, perhaps a different thread, for processing after the receiver callback returns.
Once promoted, the application has the responsibility to dispose of the message when it is finished with it by calling dispose(). See Java Message Reception.
Note that this creates a new object, so delivery is no longer "zero object".
Referenced by com.latencybusters.lbm.UMQQueueMessageStatus.flags().
UMQDeregistrationCompleteInfo com.latencybusters.lbm.LBMMessage.queueDeregistrationCompleteInfo | ( | ) |
Get an extended queue deregistration complete info object from the message (only for LBM#MSG_UMQ_DEREGISTRATION_COMPLETE_EX messages).
UMQIndexAssignedInfo com.latencybusters.lbm.LBMMessage.queueIndexAssignedInfo | ( | ) |
Get a queue index assigned info object from the message (only for LBM#MSG_UMQ_INDEX_ASSIGNED_EX messages).
UMQIndexAssignmentEligibilityStartCompleteInfo com.latencybusters.lbm.LBMMessage.queueIndexAssignmentEligibilityStartCompleteInfo | ( | ) |
Get a queue index assignment eligibility start complete info object from the message (only for LBM#MSG_UMQ_INDEX_ASSIGNMENT_ELIGIBILITY_START_COMPLETE_EX messages).
UMQIndexAssignmentEligibilityStopCompleteInfo com.latencybusters.lbm.LBMMessage.queueIndexAssignmentEligibilityStopCompleteInfo | ( | ) |
Get a queue index assignment eligibility stop complete info object from the message (only for LBM#MSG_UMQ_INDEX_ASSIGNMENT_ELIGIBILITY_STOP_COMPLETE_EX messages).
UMQIndexInfo com.latencybusters.lbm.LBMMessage.queueIndexInfo | ( | ) | throws LBMException |
Retrieve UMQ index information for this message.
LBMException | if an internal error occurs |
References com.latencybusters.lbm.UMQIndexInfo.setIndex(), com.latencybusters.lbm.UMQIndexInfo.setNumericIndex(), and com.latencybusters.lbm.LBM.UMQ_INDEX_FLAG_NUMERIC.
UMQIndexReleasedInfo com.latencybusters.lbm.LBMMessage.queueIndexReleasedInfo | ( | ) |
Get a queue index released info object from the message (only for LBM#MSG_UMQ_INDEX_RELEASED_EX messages).
UMQMessageId com.latencybusters.lbm.LBMMessage.queueMessageId | ( | ) |
The message ID assigned by the queue (UMQ only).
UMQRegistrationCompleteInfo com.latencybusters.lbm.LBMMessage.queueRegistrationCompleteInfo | ( | ) |
Get an extended queue registration complete info object from the message (only for LBM#MSG_UMQ_REGISTRATION_COMPLETE_EX messages).
void com.latencybusters.lbm.LBMMessage.reassign | ( | int | flags | ) | throws LBMException |
Do not acknowledge the given message and instead request that the message be reassigned.
LBMException | if any error occurs or the message object is not valid, or if dispose() has already been called on this LBMMessage. |
flags | Flags indicating various conditions. ORed set of values: LBM#MSG_UMQ_REASSIGN_FLAG_DISCARD |
long com.latencybusters.lbm.LBMMessage.receiverRegistrationId | ( | ) |
The registration ID for the receiver (UME only).
References com.latencybusters.lbm.LBM.MSG_UME_REGISTRATION_SUCCESS.
UMERegistrationCompleteInfo com.latencybusters.lbm.LBMMessage.registrationCompleteInfo | ( | ) |
Get an extended registration complete info object from the message (only for LBM#MSG_UME_REGISTRATION_COMPLETE_EX messages).
UMERegistrationSuccessInfo com.latencybusters.lbm.LBMMessage.registrationSuccessInfo | ( | ) |
Get an extended registration success info object from the message (only for LBM#MSG_UME_REGISTRATION_SUCCESS_EX messages).
void com.latencybusters.lbm.LBMMessage.respond | ( | byte [] | data, |
int | dataLength, | ||
int | flags | ||
) | throws LBMException |
Send a response for this request message.
Warning: It is not safe to call this method from a context thread callback.
data | Data to send in this response |
dataLength | Number of bytes of data to send in this response |
flags | Flags indicating various conditions. See next section for possible OR'd set of values. |
LBMException | if any error occurs sending the response. |
References com.latencybusters.lbm.LBM.EINVAL, and com.latencybusters.lbm.LBM.MSG_REQUEST.
void com.latencybusters.lbm.LBMMessage.sendExplicitAck | ( | ) | throws LBMException |
Send a consumption acknowledgement to the persistent Store.
This function is used in the Explicit Acknowledgments use case to signal consumption of the supplied message, and all unacknowledged messages sent before it. ume_explicit_ack_only (receiver) must be set to 1.
See Persistence Message Consumption for a full explanation of consumption acknowledgements.
LBMException | if any error occurs or the message object is not valid, or if dispose() has already been called on this LBMMessage. |
long com.latencybusters.lbm.LBMMessage.sequenceNumber | ( | ) |
LBM message (or message fragment) sequence number. When the message is 32 bit hot-failover, this will be the hot-failover sequence number. When 64 bit hot failover, this will always be 0.
String com.latencybusters.lbm.LBMMessage.source | ( | ) |
Message source
Referenced by com.latencybusters.lbm.LBMMessage.getMessagesBuffer().
char [] com.latencybusters.lbm.LBMMessage.sourceAsCharArray | ( | ) |
Message sourceAsCharArray
Object com.latencybusters.lbm.LBMMessage.sourceClientObject | ( | ) |
Get the source client object, set by an LBMSourceCreationCallback callback.
long com.latencybusters.lbm.LBMMessage.sourceRegistrationId | ( | ) |
The registration ID for the source (UME only).
References com.latencybusters.lbm.LBM.MSG_UME_REGISTRATION_SUCCESS.
long com.latencybusters.lbm.LBMMessage.timestampMicroseconds | ( | ) |
Microseconds portion of the timestamp indicating when the message was received.
long com.latencybusters.lbm.LBMMessage.timestampSeconds | ( | ) |
Seconds portion of the timestamp indicating when the message was received.
String com.latencybusters.lbm.LBMMessage.topicName | ( | ) |
Topic on which the current message has been delivered.
char [] com.latencybusters.lbm.LBMMessage.topicNameAsCharArray | ( | ) |
Message topicNameAsCharArray
long com.latencybusters.lbm.LBMMessage.totalMessageLength | ( | ) |
Total message size. This value may be larger than the length of the data byte array, if the current object represents a message fragment.
int com.latencybusters.lbm.LBMMessage.type | ( | ) |