summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2013-04-05 17:07:57 +0000
committerGordon Sim <gsim@apache.org>2013-04-05 17:07:57 +0000
commit829810db95569eb0218182efb0a94dbae1f34d5c (patch)
treee604ab0af17f55a21355c9017304dad25c881693
parentf37698a3988d22af43d2d286be8b2b68e418bec7 (diff)
downloadqpid-python-829810db95569eb0218182efb0a94dbae1f34d5c.tar.gz
QPID-4716: set durability on terminus
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1465047 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp26
-rw-r--r--qpid/cpp/src/qpid/messaging/amqp/AddressHelper.h2
2 files changed, 27 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp b/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp
index 7b9934fb26..bcdce59389 100644
--- a/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.cpp
+++ b/qpid/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/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.h b/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.h
index 4dd441d461..da666feb92 100644
--- a/qpid/cpp/src/qpid/messaging/amqp/AddressHelper.h
+++ b/qpid/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;