Quick Links:

bmqa | bmqpi | bmqt

Public Member Functions

bmqa::Message Class Reference

#include <bmqa_message.h>

List of all members.

Public Member Functions

 Message ()
 Message (const Message &other)
 ~Message ()
Messageoperator= (const Message &other)
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)
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
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

Detailed Description

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

See Component bmqa_message


Constructor & Destructor Documentation

bmqa::Message::Message (  )  [explicit]

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

bmqa::Message::Message ( const Message other  ) 

Create a message from the specified other instance.

bmqa::Message::~Message (  ) 

Destructor


Member Function Documentation

Message& bmqa::Message::operator= ( const Message other  ) 

Assign to this object the value of the specified other instance and return a reference to this object.

Message& bmqa::Message::setData ( 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).

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

Message& bmqa::Message::setData ( 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).

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

Message& 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).

Message& 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).

Message& 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).

Message& 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.

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

Set correlation ID of this message to the specified correlationId.

Message& 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.

bool bmqa::Message::isValid (  )  const

TBD:BSLS_ANNOTATION_DEPRECATED

bmqa::Message::operator bool (  )  const

TBD:BSLS_ANNOTATION_DEPRECATED

Message 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.

const bmqa::QueueId& 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.

const bmqt::CorrelationId& 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.

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

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

const bmqt::MessageGUID& 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.

MessageConfirmationCookie 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.

int 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.

int 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.

int 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.

bool 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.

int 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.

bsl::ostream& 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.


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