Loading...
Searching...
No Matches
message

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.
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.
void | inferred (bool)
| Set the inferred flag.
Transfer headers
bool | durable () const
| Get the durable flag.
void | durable (bool)
| Set the durable flag.
duration | ttl () const
| Get the TTL.
void | ttl (duration)
| Set the TTL.
uint8_t | priority () const
| Get the priority.
void | priority (uint8_t)
| Set the priority.
bool | first_acquirer () const
| Get the first acquirer flag.
void | first_acquirer (bool)
| Set the first acquirer flag.
uint32_t | delivery_count () const
| Get the delivery count.
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.
void | group_sequence (int32_t)
| Set the group sequence for a message.
Extended attributes
property_map & | properties ()
| Get the application properties map.
const property_map & | properties () const
| Examine the application properties map.
annotation_map & | message_annotations ()
| Get the message annotations map.
const annotation_map & | message_annotations () const
| Examine the message annotations map.
annotation_map & | delivery_annotations ()
| Get the delivery annotations map.
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.

## Detailed Description

An AMQP message.

Value semantics: A message can be copied or assigned to make a new message.

Examples
  broker.cpp, client.cpp, direct_recv.cpp, direct_send.cpp, helloworld.cpp, message_properties.cpp, multithreaded_client.cpp, multithreaded_client_flow_control.cpp, scheduled_send.cpp, scheduled_send_03.cpp, server.cpp, server_direct.cpp, service_bus.cpp, simple_recv.cpp, and simple_send.cpp.

## Member Function Documentation

## id()

void id | ( | const message_id & |  | ) |

Set the message ID.

The message ID uniquely identifies a message within a messaging system.

Examples
  direct_recv.cpp, direct_send.cpp, simple_recv.cpp, and simple_send.cpp.

## inferred()

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.

## durable()

bool durable | ( |  | ) | const

Get the durable flag.

The durable flag indicates that any parties taking responsibility for the message must durably store the content.

## ttl()

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.

## priority()

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.

## first_acquirer()

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.

## delivery_count()

uint32_t delivery_count | ( |  | ) | const

Get the delivery count.

The delivery count field tracks how many attempts have been made to deliver a message.

## group_sequence()

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.

## properties()

property_map & properties | ( |  | ) |

Get the application properties map.

It can be modified in place.

Examples
  message_properties.cpp.

## message_annotations()

annotation_map & message_annotations | ( |  | ) |

Get the message annotations map.

It can be modified in place.

## delivery_annotations()

annotation_map & delivery_annotations | ( |  | ) |

Get the delivery annotations map.

It can be modified in place.

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

- proton/message.hpp