From f48c4890e25c3cd76b7534cfca56e40ee30eb7ca Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 30 Jun 2011 11:54:40 +0000 Subject: QPID-3329: Configure C++ client connections to replace url-addresses rather than merging new addresses with old git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1141493 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp | 5 ++++- cpp/src/qpid/client/amqp0_10/ConnectionImpl.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/client') diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp index 473f5ecd1c..ced8cf66fd 100644 --- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp @@ -64,7 +64,7 @@ std::string asString(const std::vector& v) { } ConnectionImpl::ConnectionImpl(const std::string& url, const Variant::Map& options) : - reconnect(false), timeout(-1), limit(-1), + replaceUrls(false), reconnect(false), timeout(-1), limit(-1), minReconnectInterval(3), maxReconnectInterval(60), retries(0), reconnectOnLimitExceeded(true) { @@ -95,7 +95,10 @@ void ConnectionImpl::setOption(const std::string& name, const Variant& value) minReconnectInterval = value; } else if (name == "reconnect-interval-max" || name == "reconnect_interval_max") { maxReconnectInterval = value; + } else if (name == "reconnect-urls-replace" || name == "reconnect_urls_replace") { + replaceUrls = value.asBool(); } else if (name == "reconnect-urls" || name == "reconnect_urls") { + if (replaceUrls) urls.clear(); if (value.getType() == VAR_LIST) { merge(value.asList(), urls); } else { diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h index 9e31238bc1..1b58cbbe3e 100644 --- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h +++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h @@ -60,6 +60,7 @@ class ConnectionImpl : public qpid::messaging::ConnectionImpl qpid::sys::Semaphore semaphore;//used to coordinate reconnection Sessions sessions; qpid::client::Connection connection; + bool replaceUrls; // Replace rather than merging with reconnect-urls std::vector urls; qpid::client::ConnectionSettings settings; bool reconnect; -- cgit v1.2.1