PROTON-1039: C++ binding message transport headers
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/0a6e0e7a Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/0a6e0e7a Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/0a6e0e7a Branch: refs/heads/go1 Commit: 0a6e0e7a1adb74e4fd81d12c5b251411f2772a85 Parents: c12eae1 Author: Clifford Jansen <[email protected]> Authored: Fri Dec 18 09:19:25 2015 -0800 Committer: Clifford Jansen <[email protected]> Committed: Fri Dec 18 09:23:46 2015 -0800 ---------------------------------------------------------------------- .../bindings/cpp/include/proton/message.hpp | 85 +++++++++++++++++++- proton-c/bindings/cpp/src/message.cpp | 17 +++- 2 files changed, 98 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0a6e0e7a/proton-c/bindings/cpp/include/proton/message.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/message.hpp b/proton-c/bindings/cpp/include/proton/message.hpp index aa7b9f8..f04ea07 100644 --- a/proton-c/bindings/cpp/include/proton/message.hpp +++ b/proton-c/bindings/cpp/include/proton/message.hpp @@ -26,6 +26,7 @@ #include "proton/export.hpp" #include "proton/message_id.hpp" #include "proton/value.hpp" +#include "proton/duration.hpp" #include <string> #include <utility> @@ -151,15 +152,93 @@ class message * 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. Use - * ::pn_message_set_inferred to set the value. + * VALUE sections regardless of their type. * - * @param[in] msg a message object * @return the value of the inferred flag for the message */ PN_CPP_EXTERN bool inferred() const; + /** Get the inferred flag for a message. */ PN_CPP_EXTERN void inferred(bool); + /** + * Get the durable flag for a message. + * + * The durable flag indicates that any parties taking responsibility + * for the message must durably store the content. + * + * @return the value of the durable flag + */ + PN_CPP_EXTERN bool durable() const; + /** Get the durable flag for a message. */ + PN_CPP_EXTERN void durable(bool); + + /** + * Get the ttl for a message. + * + * The ttl 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. + * + * @return the ttl in milliseconds + */ + PN_CPP_EXTERN duration ttl() const; + /** Set the ttl for a message */ + PN_CPP_EXTERN void ttl(duration); + + /** + * Get the priority for a message. + * + * The priority of a message impacts ordering guarantees. Within a + * given ordered context, higher priority messages may jump ahead of + * lower priority messages. + * + * @return the message priority + */ + PN_CPP_EXTERN uint8_t priority() const; + /** Get the priority for a message. */ + PN_CPP_EXTERN void priority(uint8_t); + + /** + * Get the first acquirer flag for a message. + * + * 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. + * + * @return the first acquirer flag for the message + */ + PN_CPP_EXTERN bool first_acquirer() const; + /** Get the first acquirer flag for a message. */ + PN_CPP_EXTERN void first_acquirer(bool); + + /** + * Get the delivery count for a message. + * + * The delivery count field tracks how many attempts have been made to + * delivery a message. + * + * @return the delivery count for the message + */ + PN_CPP_EXTERN uint32_t delivery_count() const; + /** Get the delivery count for a message. */ + PN_CPP_EXTERN void delivery_count(uint32_t); + + /** + * Get the group sequence for a message. + * + * 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. + * + * @return the group sequence for the message + */ + PN_CPP_EXTERN uint32_t sequence() const; + /** Get the group sequence for a message. */ + PN_CPP_EXTERN void sequence(uint32_t); + private: pn_message_t *message_; }; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0a6e0e7a/proton-c/bindings/cpp/src/message.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/message.cpp b/proton-c/bindings/cpp/src/message.cpp index dd57606..dc7e50f 100644 --- a/proton-c/bindings/cpp/src/message.cpp +++ b/proton-c/bindings/cpp/src/message.cpp @@ -285,7 +285,22 @@ void message::decode(proton::link link, proton::delivery delivery) { link.advance(); } -} +bool message::durable() const { return pn_message_is_durable(message_); } +void message::durable(bool b) { pn_message_set_durable(message_, b); } + +duration message::ttl() const { return duration(pn_message_get_ttl(message_)); } +void message::ttl(duration d) { pn_message_set_ttl(message_, d.milliseconds); } + +uint8_t message::priority() const { return pn_message_get_priority(message_); } +void message::priority(uint8_t d) { pn_message_set_priority(message_, d); } +bool message::first_acquirer() const { return pn_message_is_first_acquirer(message_); } +void message::first_acquirer(bool b) { pn_message_set_first_acquirer(message_, b); } +uint32_t message::delivery_count() const { return pn_message_get_delivery_count(message_); } +void message::delivery_count(uint32_t d) { pn_message_set_delivery_count(message_, d); } +uint32_t message::sequence() const { return pn_message_get_group_sequence(message_); } +void message::sequence(uint32_t d) { pn_message_set_group_sequence(message_, d); } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
