summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2013-10-15 12:41:45 +0000
committerGordon Sim <gsim@apache.org>2013-10-15 12:41:45 +0000
commit8ec3ef4b4bd0fa0478542e194f1ea81953de21b9 (patch)
treec71ea1e6022d0bc12019b8bf678bc79471733405 /qpid/cpp
parent02913713d2184b0c9747b2ca6f6c4ace131da20d (diff)
downloadqpid-python-8ec3ef4b4bd0fa0478542e194f1ea81953de21b9.tar.gz
QPID-5228: allow alternate exchange to be set on 1.0 subscription queues
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1532306 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Session.cpp4
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Topic.cpp15
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/Topic.h2
3 files changed, 16 insertions, 5 deletions
diff --git a/qpid/cpp/src/qpid/broker/amqp/Session.cpp b/qpid/cpp/src/qpid/broker/amqp/Session.cpp
index 0c8f9a3b06..96681e2892 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Session.cpp
+++ b/qpid/cpp/src/qpid/broker/amqp/Session.cpp
@@ -397,10 +397,12 @@ void Session::setupOutgoing(pn_link_t* link, pn_terminus_t* source, const std::s
bool shared = is_capability_requested(SHARED, pn_terminus_capabilities(source));
bool durable = pn_terminus_get_durability(source);
QueueSettings settings(durable, !durable);
+ std::string altExchange;
if (node.topic) {
settings = node.topic->getPolicy();
settings.durable = durable;
settings.autodelete = !durable;
+ altExchange = node.topic->getAlternateExchange();
}
settings.autoDeleteDelay = pn_terminus_get_timeout(source);
if (settings.autoDeleteDelay) {
@@ -419,7 +421,7 @@ void Session::setupOutgoing(pn_link_t* link, pn_terminus_t* source, const std::s
queueName << connection.getContainerId() << "_" << pn_link_name(link);
}
boost::shared_ptr<qpid::broker::Queue> queue
- = connection.getBroker().createQueue(queueName.str(), settings, this, "", connection.getUserId(), connection.getId()).first;
+ = connection.getBroker().createQueue(queueName.str(), settings, this, altExchange, connection.getUserId(), connection.getId()).first;
if (!shared) queue->setExclusiveOwner(this);
authorise.outgoing(node.exchange, queue, filter);
filter.bind(node.exchange, queue);
diff --git a/qpid/cpp/src/qpid/broker/amqp/Topic.cpp b/qpid/cpp/src/qpid/broker/amqp/Topic.cpp
index 4bb581628b..9640988834 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Topic.cpp
+++ b/qpid/cpp/src/qpid/broker/amqp/Topic.cpp
@@ -31,6 +31,7 @@ namespace {
const std::string TOPIC("topic");
const std::string EXCHANGE("exchange");
const std::string DURABLE("durable");
+const std::string ALTERNATE_EXCHANGE("alternate-exchange");
const std::string EMPTY;
std::string getProperty(const std::string& k, const qpid::types::Variant::Map& m)
@@ -52,22 +53,25 @@ qpid::types::Variant::Map filter(const qpid::types::Variant::Map& properties)
qpid::types::Variant::Map filtered = properties;
filtered.erase(DURABLE);
filtered.erase(EXCHANGE);
+ filtered.erase(ALTERNATE_EXCHANGE);
return filtered;
}
}
Topic::Topic(Broker& broker, const std::string& n, const qpid::types::Variant::Map& properties)
- : PersistableObject(n, TOPIC, properties), name(n), durable(testProperty(DURABLE, properties)), exchange(broker.getExchanges().get(getProperty(EXCHANGE, properties)))
+ : PersistableObject(n, TOPIC, properties), name(n), durable(testProperty(DURABLE, properties)), exchange(broker.getExchanges().get(getProperty(EXCHANGE, properties))),
+ alternateExchange(getProperty(ALTERNATE_EXCHANGE, properties))
{
if (exchange->getName().empty()) throw qpid::Exception("Exchange must be specified.");
qpid::types::Variant::Map unused;
- policy.populate(properties, unused);
+ qpid::types::Variant::Map filtered = filter(properties);
+ policy.populate(filtered, unused);
qpid::management::ManagementAgent* agent = broker.getManagementAgent();
if (agent != 0) {
topic = _qmf::Topic::shared_ptr(new _qmf::Topic(agent, this, name, exchange->GetManagementObject()->getObjectId(), durable));
- topic->set_properties(filter(properties));
+ topic->set_properties(filtered);
agent->addObject(topic);
}
}
@@ -99,7 +103,10 @@ const std::string& Topic::getName() const
{
return name;
}
-
+const std::string& Topic::getAlternateExchange() const
+{
+ return alternateExchange;
+}
boost::shared_ptr<Topic> TopicRegistry::createTopic(Broker& broker, const std::string& name, const qpid::types::Variant::Map& properties)
{
boost::shared_ptr<Topic> topic(new Topic(broker, name, properties));
diff --git a/qpid/cpp/src/qpid/broker/amqp/Topic.h b/qpid/cpp/src/qpid/broker/amqp/Topic.h
index decebdb0d4..e08830ba0f 100644
--- a/qpid/cpp/src/qpid/broker/amqp/Topic.h
+++ b/qpid/cpp/src/qpid/broker/amqp/Topic.h
@@ -51,6 +51,7 @@ class Topic : public PersistableObject, public management::Manageable
~Topic();
const std::string& getName() const;
const QueueSettings& getPolicy() const;
+ const std::string& getAlternateExchange() const;
boost::shared_ptr<Exchange> getExchange();
bool isDurable() const;
boost::shared_ptr<qpid::management::ManagementObject> GetManagementObject() const;
@@ -59,6 +60,7 @@ class Topic : public PersistableObject, public management::Manageable
bool durable;
boost::shared_ptr<Exchange> exchange;
QueueSettings policy;
+ std::string alternateExchange;
qmf::org::apache::qpid::broker::Topic::shared_ptr topic;
};