summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-05-11 10:06:30 +0000
committerGordon Sim <gsim@apache.org>2010-05-11 10:06:30 +0000
commitbe8e1bf6b6a0d760bddbbe6642d477a95f36ab42 (patch)
treee1863cf84997106773756b8f013c1da799439652 /cpp/src
parentb7112a8d67d0fbb02eb59c5c7251c1cf1ae3c1c5 (diff)
downloadqpid-python-be8e1bf6b6a0d760bddbbe6642d477a95f36ab42.tar.gz
QPID-664: Add default constructor for Connection; add option to set url on existing connection.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@943071 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp15
-rw-r--r--cpp/src/qpid/messaging/Connection.cpp7
2 files changed, 17 insertions, 5 deletions
diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
index 2ee9cf3fc0..6c3c9c5218 100644
--- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
+++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
@@ -103,7 +103,7 @@ ConnectionImpl::ConnectionImpl(const std::string& url, const Variant::Map& optio
{
QPID_LOG(debug, "Created connection with " << options);
setOptions(options);
- urls.push_back(url);
+ urls.insert(urls.begin(), url);
}
void ConnectionImpl::setOptions(const Variant::Map& options)
@@ -125,10 +125,15 @@ void ConnectionImpl::setOptions(const Variant::Map& options)
void ConnectionImpl::setOption(const std::string& name, const Variant& value)
{
- Variant::Map options;
- options[name] = value;
- setOptions(options);
- QPID_LOG(debug, "Set " << name << " to " << value);
+ if (name == "url") {
+ if (urls.size()) urls[0] = value.asString();
+ else urls.insert(urls.begin(), value.asString());
+ } else {
+ Variant::Map options;
+ options[name] = value;
+ setOptions(options);
+ QPID_LOG(debug, "Set " << name << " to " << value);
+ }
}
void ConnectionImpl::close()
diff --git a/cpp/src/qpid/messaging/Connection.cpp b/cpp/src/qpid/messaging/Connection.cpp
index 80e96af1d6..53d37562e7 100644
--- a/cpp/src/qpid/messaging/Connection.cpp
+++ b/cpp/src/qpid/messaging/Connection.cpp
@@ -54,6 +54,13 @@ Connection::Connection(const std::string& url, const Variant::Map& options)
PI::ctor(*this, new qpid::client::amqp0_10::ConnectionImpl(url, options));
}
+Connection::Connection()
+{
+ Variant::Map options;
+ std::string url = "amqp:tcp:127.0.0.1:5672";
+ PI::ctor(*this, new qpid::client::amqp0_10::ConnectionImpl(url, options));
+}
+
void Connection::open() { impl->open(); }
bool Connection::isOpen() { return impl->isOpen(); }
void Connection::close() { impl->close(); }