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/04/16 19:59:05 UTC

svn commit: r1588001 - /qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp

Author: gsim
Date: Wed Apr 16 17:59:04 2014
New Revision: 1588001

URL: http://svn.apache.org/r1588001
Log:
QPID-5707: treat '#' as implying create for exchange as well as queue

Modified:
    qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp?rev=1588001&r1=1588000&r2=1588001&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp Wed Apr 16 17:59:04 2014
@@ -215,7 +215,7 @@ class Exchange : protected Node
     const std::string specifiedType;
   private:
     const bool durable;
-    const bool autoDelete;
+    bool autoDelete;
     const std::string alternateExchange;
     FieldTable arguments;
 };
@@ -326,6 +326,7 @@ struct Opt
     bool asBool(bool defaultValue) const;
     const Variant::List& asList() const;
     void collect(qpid::framing::FieldTable& args) const;
+    bool hasKey(const std::string&) const;
 
     const Variant::Map* options;
     const Variant* value;
@@ -384,6 +385,15 @@ void Opt::collect(qpid::framing::FieldTa
         translate(value->asMap(), args);
     }
 }
+bool Opt::hasKey(const std::string& key) const
+{
+    if (value) {
+        Variant::Map::const_iterator i = value->asMap().find(key);
+        return i != value->asMap().end();
+    } else {
+        return false;
+    }
+}
 
 bool AddressResolution::is_unreliable(const Address& address)
 {
@@ -727,8 +737,9 @@ Queue::Queue(const Address& a) : Node(a)
     linkBindings.setDefaultQueue(name);
     if (qpid::messaging::AddressImpl::isTemporary(a) && createPolicy.isVoid()) {
         createPolicy = "always";
-        autoDelete = true;
-        exclusive = true;
+        Opt specified = Opt(a)/NODE/X_DECLARE;
+        if (!specified.hasKey(AUTO_DELETE)) autoDelete = true;
+        if (!specified.hasKey(EXCLUSIVE)) exclusive = true;
     }
 }
 
@@ -816,6 +827,10 @@ Exchange::Exchange(const Address& a) : N
     (Opt(a)/NODE/X_DECLARE/ARGUMENTS).collect(arguments);
     nodeBindings.setDefaultExchange(name);
     linkBindings.setDefaultExchange(name);
+    if (qpid::messaging::AddressImpl::isTemporary(a) && createPolicy.isVoid()) {
+        createPolicy = "always";
+        if (!(Opt(a)/NODE/X_DECLARE).hasKey(AUTO_DELETE)) autoDelete = true;
+    }
 }
 
 bool Exchange::isReservedName()



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