An AMQP message. More...
#include <message.hpp>
Public Types | |
typedef map< std::string, scalar > | property_map |
A map of string keys and AMQP scalar values. | |
typedef map< annotation_key, value > | annotation_map |
A map of AMQP annotation keys and AMQP values. | |
Public Member Functions | |
message () | |
Create an empty message. | |
message (const message &) | |
Copy a message. | |
message & | operator= (const message &) |
Copy a message. | |
message (message &&) | |
Move a message. | |
message & | operator= (message &&) |
Move a message. | |
message (const value &x) | |
Create a message with its body set from any value that can be converted to a proton::value. | |
Basic properties and methods | |
void | clear () |
Clear the message content and properties. | |
void | id (const message_id &) |
Set the message ID. More... | |
message_id | id () const |
Get the message ID. | |
void | user (const std::string &) |
Set the user name or ID. | |
std::string | user () const |
Get the user name or ID. | |
void | encode (std::vector< char > &) const |
Encode entire message into a byte vector, growing it if necessary. | |
std::vector< char > | encode () const |
Return encoded message as a byte vector. | |
void | decode (const std::vector< char > &) |
Decode from string data into the message. | |
Routing | |
void | to (const std::string &) |
Set the destination address. | |
std::string | to () const |
Get the destination address. | |
void | reply_to (const std::string &) |
Set the address for replies. | |
std::string | reply_to () const |
Get the address for replies. | |
void | correlation_id (const message_id &) |
Set the ID for matching related messages. | |
message_id | correlation_id () const |
Get the ID for matching related messages. | |
Content | |
void | body (const value &x) |
Set the body. Equivalent to body() = x . | |
const value & | body () const |
Get the body. | |
value & | body () |
Get a reference to the body that can be modified in place. | |
void | subject (const std::string &) |
Set the subject. | |
std::string | subject () const |
Get the subject. | |
void | content_type (const std::string &) |
Set the content type of the body. | |
std::string | content_type () const |
Get the content type of the body. | |
void | content_encoding (const std::string &) |
Set the content encoding of the body. | |
std::string | content_encoding () const |
Get the content encoding of the body. | |
void | expiry_time (timestamp) |
Set the expiration time. | |
timestamp | expiry_time () const |
Get the expiration time. | |
void | creation_time (timestamp) |
Set the creation time. | |
timestamp | creation_time () const |
Get the creation time. | |
bool | inferred () const |
Get the inferred flag. More... | |
void | inferred (bool) |
Set the inferred flag. | |
Transfer headers | |
bool | durable () const |
Get the durable flag. More... | |
void | durable (bool) |
Set the durable flag. | |
duration | ttl () const |
Get the TTL. More... | |
void | ttl (duration) |
Set the TTL. | |
uint8_t | priority () const |
Get the priority. More... | |
void | priority (uint8_t) |
Set the priority. | |
bool | first_acquirer () const |
Get the first acquirer flag. More... | |
void | first_acquirer (bool) |
Set the first acquirer flag. | |
uint32_t | delivery_count () const |
Get the delivery count. More... | |
void | delivery_count (uint32_t) |
Get the delivery count. | |
Message groups | |
void | group_id (const std::string &) |
Set the message group ID. | |
std::string | group_id () const |
Get the message group ID. | |
void | reply_to_group_id (const std::string &) |
Set the reply-to group ID. | |
std::string | reply_to_group_id () const |
Get the reply-to group ID. | |
int32_t | group_sequence () const |
Get the group sequence. More... | |
void | group_sequence (int32_t) |
Set the group sequence for a message. | |
Extended attributes | |
property_map & | properties () |
Get the application properties map. More... | |
const property_map & | properties () const |
Examine the application properties map. | |
annotation_map & | message_annotations () |
Get the message annotations map. More... | |
const annotation_map & | message_annotations () const |
Examine the message annotations map. | |
annotation_map & | delivery_annotations () |
Get the delivery annotations map. More... | |
const annotation_map & | delivery_annotations () const |
Examine the delivery annotations map. | |
Static Public Attributes | |
static const uint8_t | default_priority |
Default priority assigned to new messages. | |
Friends | |
std::ostream & | operator<< (std::ostream &, const message &) |
Human readable string representation. | |
An AMQP message.
Value semantics: A message can be copied or assigned to make a new message.
void id | ( | const message_id & | ) |
Set the message ID.
The message ID uniquely identifies a message within a messaging system.
bool inferred | ( | ) | const |
Get the inferred flag.
The inferred flag for a message indicates how the message content is encoded into AMQP sections. If the inferred is true then binary and list values in the body of the message will be encoded as AMQP DATA and AMQP SEQUENCE sections, respectively. If inferred is false, then all values in the body of the message will be encoded as AMQP VALUE sections regardless of their type.
bool durable | ( | ) | const |
Get the durable flag.
The durable flag indicates that any parties taking responsibility for the message must durably store the content.
duration ttl | ( | ) | const |
Get the TTL.
The TTL (time to live) for a message determines how long a message is considered live. When a message is held for retransmit, the TTL is decremented. Once the TTL reaches zero, the message is considered dead. Once a message is considered dead, it may be dropped.
uint8_t priority | ( | ) | const |
Get the priority.
The priority of a message impacts ordering guarantees. Within a given ordered context, higher priority messages may jump ahead of lower priority messages.
The default value set on newly constructed messages is message::default_priority.
bool first_acquirer | ( | ) | const |
Get the first acquirer flag.
When set to true, the first acquirer flag for a message indicates that the recipient of the message is the first recipient to acquire the message, i.e. there have been no failed delivery attempts to other acquirers. Note that this does not mean the message has not been delivered to, but not acquired, by other recipients.
uint32_t delivery_count | ( | ) | const |
Get the delivery count.
The delivery count field tracks how many attempts have been made to deliver a message.
int32_t group_sequence | ( | ) | const |
Get the group sequence.
The group sequence of a message identifies the relative ordering of messages within a group. The default value for the group sequence of a message is zero.
property_map& properties | ( | ) |
annotation_map& message_annotations | ( | ) |
Get the message annotations map.
It can be modified in place.
annotation_map& delivery_annotations | ( | ) |
Get the delivery annotations map.
It can be modified in place.