You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2013/10/15 14:41:46 UTC

svn commit: r1532306 - in /qpid/trunk/qpid/cpp/src/qpid/broker/amqp: Session.cpp Topic.cpp Topic.h

Author: gsim
Date: Tue Oct 15 12:41:45 2013
New Revision: 1532306

URL: http://svn.apache.org/r1532306
Log:
QPID-5228: allow alternate exchange to be set on 1.0 subscription queues

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp?rev=1532306&r1=1532305&r2=1532306&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp Tue Oct 15 12:41:45 2013
@@ -397,10 +397,12 @@ void Session::setupOutgoing(pn_link_t* l
         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* l
             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);

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.cpp?rev=1532306&r1=1532305&r2=1532306&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.cpp Tue Oct 15 12:41:45 2013
@@ -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 q
     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() cons
 {
     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));

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.h?rev=1532306&r1=1532305&r2=1532306&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Topic.h Tue Oct 15 12:41:45 2013
@@ -51,6 +51,7 @@ class Topic : public PersistableObject, 
     ~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, 
     bool durable;
     boost::shared_ptr<Exchange> exchange;
     QueueSettings policy;
+    std::string alternateExchange;
     qmf::org::apache::qpid::broker::Topic::shared_ptr topic;
 };
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org