1 #ifndef PROTON_CPP_MESSAGE_H
2 #define PROTON_CPP_MESSAGE_H
25 #include "proton/export.hpp"
26 #include "proton/message_id.hpp"
27 #include "proton/annotation_key.hpp"
28 #include "proton/pn_unique_ptr.hpp"
29 #include "proton/value.hpp"
30 #include "proton/duration.hpp"
68 template <
class T>
message(
const T& x) : pn_msg_(0) {
body() = x; }
79 PN_CPP_EXTERN
void clear();
87 PN_CPP_EXTERN
void user_id(
const std::string &user);
88 PN_CPP_EXTERN std::string user_id()
const;
93 PN_CPP_EXTERN
void encode(std::vector<char> &bytes)
const;
96 PN_CPP_EXTERN std::vector<char>
encode()
const;
99 PN_CPP_EXTERN
void decode(
const std::vector<char> &bytes);
113 PN_CPP_EXTERN
void address(
const std::string &addr);
114 PN_CPP_EXTERN std::string address()
const;
116 PN_CPP_EXTERN
void reply_to(
const std::string &addr);
117 PN_CPP_EXTERN std::string reply_to()
const;
119 PN_CPP_EXTERN
void correlation_id(
const message_id&);
120 PN_CPP_EXTERN
message_id correlation_id()
const;
128 template<
class T>
void body(
const T& v) {
body() = v; }
136 PN_CPP_EXTERN
void subject(
const std::string &s);
137 PN_CPP_EXTERN std::string subject()
const;
139 PN_CPP_EXTERN
void content_type(
const std::string &s);
140 PN_CPP_EXTERN std::string content_type()
const;
142 PN_CPP_EXTERN
void content_encoding(
const std::string &s);
143 PN_CPP_EXTERN std::string content_encoding()
const;
145 PN_CPP_EXTERN
void expiry_time(amqp_timestamp t);
146 PN_CPP_EXTERN amqp_timestamp expiry_time()
const;
148 PN_CPP_EXTERN
void creation_time(amqp_timestamp t);
149 PN_CPP_EXTERN amqp_timestamp creation_time()
const;
160 PN_CPP_EXTERN
bool inferred()
const;
175 PN_CPP_EXTERN
bool durable()
const;
177 PN_CPP_EXTERN
void durable(
bool);
196 PN_CPP_EXTERN uint8_t
priority()
const;
199 PN_CPP_EXTERN
void priority(uint8_t);
228 PN_CPP_EXTERN
void group_id(
const std::string &s);
229 PN_CPP_EXTERN std::string group_id()
const;
231 PN_CPP_EXTERN
void reply_to_group_id(
const std::string &s);
232 PN_CPP_EXTERN std::string reply_to_group_id()
const;
263 pn_message_t *pn_msg()
const;
265 mutable pn_message_t *pn_msg_;
279 #endif // PROTON_CPP_MESSAGE_H
duration ttl() const
Get the TTL for a message.
An AMQP message.
Definition: message.hpp:48
std::map< std::string, scalar > property_map
A map of string keys and AMQP scalar values.
Definition: message.hpp:51
A span of time in milliseconds.
Definition: duration.hpp:32
A named channel for sending or receiving messages.
Definition: link.hpp:43
void decode(const std::vector< char > &bytes)
Decode from string data into the message.
annotation_map & message_annotations()
Message annotations map, can be modified in place.
annotation_map & delivery_annotations()
Delivery annotations map, can be modified in place.
property_map & application_properties()
Application properties map, can be modified in place.
A message transfer.
Definition: delivery.hpp:36
uint32_t delivery_count() const
Get the delivery count for a message.
bool durable() const
Get the durable flag for a message.
A holder for an AMQP value.
Definition: value.hpp:33
message & operator=(const message &)
Copy a message.
void clear()
Clear the message content and properties.
uint8_t priority() const
Get the priority for a message.
bool inferred() const
Get the inferred flag for a message.
int32_t group_sequence() const
Get the group sequence for a message.
message(const T &x)
Create a message with its body set from any value that can be assigned to a proton::value.
Definition: message.hpp:68
void body(const T &v)
Set the body, equivalent to body() = v.
Definition: message.hpp:128
std::vector< char > encode() const
Return encoded message as a byte vector.
std::map< annotation_key, value > annotation_map
A map of AMQP annotation keys and AMQP values.
Definition: message.hpp:54
bool first_acquirer() const
Get the first acquirer flag for a message.
const value & body() const
Get the body.
An AMQP message ID.
Definition: message_id.hpp:39
message()
Create an empty message.