libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
BloombergLP::bmqa::Message Class Reference

A message sent/received to/from the BlazingMQ broker.

#include <bmqa_message.h>

Public Member Functions

 Message ()
 
MessagesetData (const bdlbb::Blob *data) BSLS_ANNOTATION_DEPRECATED
 
MessagesetData (const char *data, size_t length) BSLS_ANNOTATION_DEPRECATED
 
MessagesetDataRef (const bdlbb::Blob *data)
 
MessagesetDataRef (const char *data, size_t length)
 
MessagesetPropertiesRef (const MessageProperties *properties)
 
MessageclearPropertiesRef ()
 
MessagesetCorrelationId (const bmqt::CorrelationId &correlationId)
 Set correlation ID of this message to the specified correlationId. More...
 
MessagesetCompressionAlgorithmType (bmqt::CompressionAlgorithmType::Enum value)
 
bool isValid () const
 
 operator bool () const
 
Message clone (bslma::Allocator *basicAllocator=0) const
 
const bmqa::QueueIdqueueId () const
 
const bmqt::CorrelationIdcorrelationId () const
 
const bmqt::SubscriptionHandlesubscriptionHandle () const
 
bmqt::CompressionAlgorithmType::Enum compressionAlgorithmType () const
 
const bmqt::MessageGUIDmessageGUID () const
 
MessageConfirmationCookie confirmationCookie () const
 
int ackStatus () const
 
int getData (bdlbb::Blob *blob) const
 
int dataSize () const
 
bool hasProperties () const
 
int loadProperties (MessageProperties *buffer) const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Constructor & Destructor Documentation

◆ Message()

BloombergLP::bmqa::Message::Message ( )

Create an invalid message having no content. Only valid operations on an invalid message instance are assignment and destruction.

Member Function Documentation

◆ setData() [1/2]

Message & BloombergLP::bmqa::Message::setData ( const bdlbb::Blob *  data)
inline

Set the payload of this message to the blob pointed to by the specified data. Behavior is undefined unless data is non-null and payload's length is greater than zero. Note that payload pointed to by data is not copied right away, and should not be destroyed or modified until this message has been packed (see bmqa::MessageEventBuilder component level documentation for correct usage).

This method is deprecated, please use setDataRef() instead.

References setDataRef().

◆ setData() [2/2]

Message & BloombergLP::bmqa::Message::setData ( const char *  data,
size_t  length 
)
inline

References setDataRef().

◆ setDataRef() [1/2]

Message& BloombergLP::bmqa::Message::setDataRef ( const bdlbb::Blob *  data)

Set the payload of this message to the blob pointed to by the specified data. Behavior is undefined unless data is non-null and payload's length is greater than zero. Note that payload pointed to by data is not copied right away, and should not be destroyed or modified until this message has been packed (see bmqa::MessageEventBuilder component level documentation for correct usage).

Referenced by setData().

◆ setDataRef() [2/2]

Message& BloombergLP::bmqa::Message::setDataRef ( const char *  data,
size_t  length 
)

Set the payload of this message to the specified length bytes starting at the specified data address. The behavior is undefined unless data is non-null and length is greater than zero. Note that payload pointed to by data is not copied right away, and should not be destroyed or modified until this message has been packed (see bmqa::MessageEventBuilder component level documentation for correct usage).

◆ setPropertiesRef()

Message& BloombergLP::bmqa::Message::setPropertiesRef ( const MessageProperties properties)

Set the properties of this message to the MessageProperties instance pointed by the specified properties. Behavior is undefined unless properties is non-null. Note that properties are not copied right away, and should not be destroyed or modified until this message has been packed (see bmqa::MessageEventBuilder component level documentation for correct usage).

◆ clearPropertiesRef()

Message& BloombergLP::bmqa::Message::clearPropertiesRef ( )

Clear out and properties associated with this message. Note that if there are no properties associated with this message, this method has no effect. Also note that the associated MessageProperties instance, if any, is not modified; it's simply dissociated from this message.

◆ setCorrelationId()

Message& BloombergLP::bmqa::Message::setCorrelationId ( const bmqt::CorrelationId correlationId)

◆ setCompressionAlgorithmType()

Message& BloombergLP::bmqa::Message::setCompressionAlgorithmType ( bmqt::CompressionAlgorithmType::Enum  value)

Set the Compression algorithm type of the current message to the specified value and return a reference offering modifiable access to this object.

◆ isValid()

bool BloombergLP::bmqa::Message::isValid ( ) const

Return true if the message is valid, and false otherwise. Any operation except assignment or destruction on an invalid message is an error.

This method is deprecated.

◆ operator bool()

BloombergLP::bmqa::Message::operator bool ( ) const
inline

Same as isValid.

This method is deprecated.

◆ clone()

Message BloombergLP::bmqa::Message::clone ( bslma::Allocator *  basicAllocator = 0) const

Return a copy of this message, using the optionally specified basicAllocator with the copy holding all the data of this instance and not backed by any MessageEvent. Note that this operation does not copy underlying data.

◆ queueId()

const bmqa::QueueId& BloombergLP::bmqa::Message::queueId ( ) const

Return the queue ID indicating the queue for which this message has been received from. The behavior is undefined unless this instance represents a PUT, PUSH or ACK message.

◆ correlationId()

const bmqt::CorrelationId& BloombergLP::bmqa::Message::correlationId ( ) const

Return the correlation Id associated with this message. The behavior is undefined unless this instance represents a PUT or an ACK, or a PUSH message. Note that in case of failure to accept a PUT message, BlazingMQ sends an ACK message with failed status, even if an ACK message was not requested by the application (i.e., no correlationId was specified when posting the message). In such cases, correlationId associated with the ACK message will be unset, and as such, application must check for that by invoking isUnset on the returned correlationId object. In the case of a PUSH message, the return value is the one specified as the correlation id of the corresponding Subscription. Invoking thePointer, theNumeric or theSharedPtr on an unset correlationId instance will lead to undefined behavior.

◆ subscriptionHandle()

const bmqt::SubscriptionHandle& BloombergLP::bmqa::Message::subscriptionHandle ( ) const

Return the subscription handle associated with this message. The behavior is undefined unless this instance represents a 'PUSH' message. The return value is the one specified as the subscription handle of the corresponding Subscription.

◆ compressionAlgorithmType()

bmqt::CompressionAlgorithmType::Enum BloombergLP::bmqa::Message::compressionAlgorithmType ( ) const

Return Compression algorithm type of the current message. Behavior is undefined unless this instance represents a PUT or PUSH message.

◆ messageGUID()

const bmqt::MessageGUID& BloombergLP::bmqa::Message::messageGUID ( ) const

Return the unique message Id generated by the SDK for this message. The behavior is undefined unless this instance represents a PUT, a PUSH or an ACK message.

◆ confirmationCookie()

MessageConfirmationCookie BloombergLP::bmqa::Message::confirmationCookie ( ) const

Return a cookie which can be used to confirm this message. The behavior is undefined unless this instance represents a PUSH message.

Referenced by BloombergLP::bmqa::ConfirmEventBuilder::addMessageConfirmation().

◆ ackStatus()

int BloombergLP::bmqa::Message::ackStatus ( ) const

Return the status of the ACK message. The behavior is undefined unless this instance represents an ACK message. This value correspond to the bmqt::AckResult::Enum enum.

◆ getData()

int BloombergLP::bmqa::Message::getData ( bdlbb::Blob *  blob) const

Load into the specified blob the payload of the message, if any. Return zero if the message has a payload and non-zero value otherwise. The behaviour is undefined unless this instance represents a PUT or PUSH message. Note that for efficiency, application should fetch payload once and cache the value, instead of invoking this method multiple times on a message.

◆ dataSize()

int BloombergLP::bmqa::Message::dataSize ( ) const

Return the number of bytes in the payload. The behaviour is undefined unless this instance represents a PUT or a PUSH message. Note that for efficiency, application should fetch payload size once and cache the value, instead of invoking this method multiple times on a message.

◆ hasProperties()

bool BloombergLP::bmqa::Message::hasProperties ( ) const

Return true if this instance has at least one message property associated with it, false otherwise. Behavior is undefined unless this instance represents a PUT or a PUSH message.

◆ loadProperties()

int BloombergLP::bmqa::Message::loadProperties ( MessageProperties buffer) const

Load into the specified buffer the properties associated with this message. Return zero on success, and a non-zero value otherwise. Behavior is undefined unless this instance represents a PUT or a PUSH message, and unless buffer is non-null. Note that if there are no properties associated with this message, zero will be returned and the MessageProperties instance pointed by buffer will be cleared. Also note that for efficiency, application should fetch properties once and cache the value, instead of invoking this method multiple times on a message.

◆ print()

bsl::ostream& BloombergLP::bmqa::Message::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect.

Referenced by BloombergLP::bmqa::operator<<().


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