diff options
| author | Gordon Sim <gsim@apache.org> | 2013-04-05 17:07:57 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-04-05 17:07:57 +0000 |
| commit | f631d6e7b944dde46936c16529cfbc4910ccb7ce (patch) | |
| tree | f915aaee370defa3946208df46e6687ac6f8b68c /cpp | |
| parent | 1ed8aa63efcd2904ce2c5b2a6b51e4513d3eae03 (diff) | |
| download | qpid-python-f631d6e7b944dde46936c16529cfbc4910ccb7ce.tar.gz | |
QPID-4716: set durability on terminus
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1465047 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/AddressHelper.cpp | 26 | ||||
| -rw-r--r-- | cpp/src/qpid/messaging/amqp/AddressHelper.h | 2 |
2 files changed, 27 insertions, 1 deletions
diff --git a/cpp/src/qpid/messaging/amqp/AddressHelper.cpp b/cpp/src/qpid/messaging/amqp/AddressHelper.cpp index 7b9934fb26..bcdce59389 100644 --- a/cpp/src/qpid/messaging/amqp/AddressHelper.cpp +++ b/cpp/src/qpid/messaging/amqp/AddressHelper.cpp @@ -51,6 +51,9 @@ const std::string NODE("node"); const std::string LINK("link"); const std::string CAPABILITIES("capabilities"); const std::string PROPERTIES("properties"); +const std::string MODE("mode"); +const std::string BROWSE("browse"); +const std::string CONSUME("consume"); const std::string TYPE("type"); const std::string TOPIC("topic"); @@ -166,7 +169,13 @@ void flatten(Variant::Map& base, const std::string& nested) } } -AddressHelper::AddressHelper(const Address& address) : isTemporary(AddressImpl::isTemporary(address)), name(address.getName()), type(address.getType()) +AddressHelper::AddressHelper(const Address& address) : + isTemporary(AddressImpl::isTemporary(address)), + name(address.getName()), + type(address.getType()), + durableNode(false), + durableLink(false), + browse(false) { bind(address, CREATE, createPolicy); bind(address, DELETE, deletePolicy); @@ -177,6 +186,15 @@ AddressHelper::AddressHelper(const Address& address) : isTemporary(AddressImpl:: bind(node, PROPERTIES, properties); bind(node, CAPABILITIES, capabilities); durableNode = test(node, DURABLE); + durableLink = test(link, DURABLE); + std::string mode; + if (bind(address, MODE, mode)) { + if (mode == BROWSE) { + browse = true; + } else if (mode != CONSUME) { + throw qpid::messaging::AddressError("Invalid value for mode; must be 'browse' or 'consume'."); + } + } if (!deletePolicy.empty()) { throw qpid::messaging::AddressError("Delete policies not supported over AMQP 1.0."); @@ -289,6 +307,12 @@ void AddressHelper::configure(pn_terminus_t* terminus, CheckMode mode) } } setCapabilities(terminus, createOnDemand); + if (durableLink) { + pn_terminus_set_durability(terminus, PN_DELIVERIES); + } + if (mode == FOR_RECEIVER && browse) { + //when PROTON-139 is resolved, set the required delivery-mode + } } void AddressHelper::setCapabilities(pn_terminus_t* terminus, bool create) diff --git a/cpp/src/qpid/messaging/amqp/AddressHelper.h b/cpp/src/qpid/messaging/amqp/AddressHelper.h index 4dd441d461..da666feb92 100644 --- a/cpp/src/qpid/messaging/amqp/AddressHelper.h +++ b/cpp/src/qpid/messaging/amqp/AddressHelper.h @@ -53,6 +53,8 @@ class AddressHelper std::string name; std::string type; bool durableNode; + bool durableLink; + bool browse; bool enabled(const std::string& policy, CheckMode mode) const; bool createEnabled(CheckMode mode) const; |
