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 2014/01/20 22:19:04 UTC

svn commit: r1559830 - in /qpid/branches/0.26/qpid: ./ cpp/src/ cpp/src/qpid/broker/ cpp/src/qpid/broker/amqp/NodeProperties.cpp cpp/src/qpid/broker/amqp/NodeProperties.h cpp/src/qpid/broker/amqp/Session.cpp cpp/src/qpid/broker/amqp/Session.h

Author: gsim
Date: Mon Jan 20 21:19:04 2014
New Revision: 1559830

URL: http://svn.apache.org/r1559830
Log:
QPID-5463: make dynamic nodes auto deleted by default

Modified:
    qpid/branches/0.26/qpid/   (props changed)
    qpid/branches/0.26/qpid/cpp/src/   (props changed)
    qpid/branches/0.26/qpid/cpp/src/qpid/broker/   (props changed)
    qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp
    qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h
    qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.cpp
    qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.h

Propchange: qpid/branches/0.26/qpid/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid:r1556603,1557262

Propchange: qpid/branches/0.26/qpid/cpp/src/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src:r1557262

Propchange: qpid/branches/0.26/qpid/cpp/src/qpid/broker/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src/qpid/broker:r1557262

Modified: qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp?rev=1559830&r1=1559829&r2=1559830&view=diff
==============================================================================
--- qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp (original)
+++ qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.cpp Mon Jan 20 21:19:04 2014
@@ -103,7 +103,8 @@ bool getLifetimeDescriptorSymbol(QueueSe
 
 }
 
-NodeProperties::NodeProperties() : received(false), queue(true), durable(false), autoDelete(false), exclusive(false), exchangeType("topic"), lifetime(QueueSettings::DELETE_IF_UNUSED) {}
+NodeProperties::NodeProperties(bool isDynamic) : received(false), queue(true), durable(false), autoDelete(false), exclusive(false),
+                                                 dynamic(isDynamic), exchangeType("topic"), lifetime(QueueSettings::DELETE_IF_UNUSED) {}
 
 void NodeProperties::read(pn_data_t* data)
 {
@@ -111,6 +112,11 @@ void NodeProperties::read(pn_data_t* dat
     reader.read(data);
 }
 
+bool NodeProperties::wasSpecified(const std::string& key) const
+{
+    return specified.find(key) != specified.end();
+}
+
 void NodeProperties::write(pn_data_t* data, boost::shared_ptr<Queue> node)
 {
     if (received) {
@@ -202,6 +208,7 @@ void NodeProperties::process(const std::
 {
     received = true;
     QPID_LOG(debug, "Processing node property " << key << " = " << value);
+    specified.insert(key);
     if (key == SUPPORTED_DIST_MODES) {
         if (value == MOVE) queue = true;
         else if (value == COPY) queue = false;
@@ -317,7 +324,9 @@ void NodeProperties::onSymbolValue(const
 
 QueueSettings NodeProperties::getQueueSettings()
 {
-    QueueSettings settings(durable, autoDelete);
+    //assume autodelete for dynamic nodes unless explicitly requested
+    //otherwise or unless durability is requested
+    QueueSettings settings(durable, autoDelete || (dynamic && !wasSpecified(AUTO_DELETE) && !durable));
     qpid::types::Variant::Map unused;
     settings.populate(properties, unused);
     settings.lifetime = lifetime;

Modified: qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h
URL: http://svn.apache.org/viewvc/qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h?rev=1559830&r1=1559829&r2=1559830&view=diff
==============================================================================
--- qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h (original)
+++ qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/NodeProperties.h Mon Jan 20 21:19:04 2014
@@ -24,6 +24,7 @@
 #include "qpid/amqp/MapReader.h"
 #include "qpid/types/Variant.h"
 #include "qpid/broker/QueueSettings.h"
+#include <set>
 #include <boost/shared_ptr.hpp>
 
 struct pn_data_t;
@@ -37,7 +38,7 @@ namespace amqp {
 class NodeProperties : public qpid::amqp::MapReader
 {
   public:
-    NodeProperties();
+    NodeProperties(bool isDynamic);
     void read(pn_data_t*);
     void write(pn_data_t*,boost::shared_ptr<Queue>);
     void write(pn_data_t*,boost::shared_ptr<Exchange>);
@@ -73,12 +74,15 @@ class NodeProperties : public qpid::amqp
     bool durable;
     bool autoDelete;
     bool exclusive;
+    bool dynamic;
     std::string exchangeType;
     std::string alternateExchange;
     qpid::types::Variant::Map properties;
     QueueSettings::LifetimePolicy lifetime;
+    std::set<std::string> specified;
 
     void process(const std::string&, const qpid::types::Variant&, const qpid::amqp::Descriptor*);
+    bool wasSpecified(const std::string& key) const;
 };
 }}} // namespace qpid::broker::amqp
 

Modified: qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.cpp?rev=1559830&r1=1559829&r2=1559830&view=diff
==============================================================================
--- qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.cpp (original)
+++ qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.cpp Mon Jan 20 21:19:04 2014
@@ -216,7 +216,7 @@ Session::ResolvedNode Session::resolve(c
     }
     //check whether user is even allowed access to queues/topics before resolving
     authorise.access(name, isQueueRequested, isTopicRequested);
-    ResolvedNode node;
+    ResolvedNode node(pn_terminus_is_dynamic(terminus));
     if (isTopicRequested || !isQueueRequested) {
         node.topic = connection.getTopics().get(name);
         if (node.topic) node.exchange = node.topic->getExchange();

Modified: qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.h
URL: http://svn.apache.org/viewvc/qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.h?rev=1559830&r1=1559829&r2=1559830&view=diff
==============================================================================
--- qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.h (original)
+++ qpid/branches/0.26/qpid/cpp/src/qpid/broker/amqp/Session.h Mon Jan 20 21:19:04 2014
@@ -100,6 +100,7 @@ class Session : public ManagedSession, p
         boost::shared_ptr<qpid::broker::amqp::Topic> topic;
         boost::shared_ptr<Relay> relay;
         NodeProperties properties;
+        ResolvedNode(bool isDynamic) : properties(isDynamic) {}
     };
 
     ResolvedNode resolve(const std::string name, pn_terminus_t* terminus, bool incoming);



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