summaryrefslogtreecommitdiff
path: root/qpid/cpp/examples/messaging/drain.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-01-28 08:37:37 +0000
committerGordon Sim <gsim@apache.org>2010-01-28 08:37:37 +0000
commit1e275cd7e3c1eb5e8e0fbe550b846bbfe2309d51 (patch)
tree75e3aceacd5fd31130cc46cd9abfd564cc3d1433 /qpid/cpp/examples/messaging/drain.cpp
parent73aec7c7edc1f43dcadf6b60627299ab1fa81a34 (diff)
downloadqpid-python-1e275cd7e3c1eb5e8e0fbe550b846bbfe2309d51.tar.gz
QPID-664: change format of connection options string to match address options; make open() a non-static method.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@904000 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/examples/messaging/drain.cpp')
-rw-r--r--qpid/cpp/examples/messaging/drain.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qpid/cpp/examples/messaging/drain.cpp b/qpid/cpp/examples/messaging/drain.cpp
index 3834aa3dfd..21c7df7388 100644
--- a/qpid/cpp/examples/messaging/drain.cpp
+++ b/qpid/cpp/examples/messaging/drain.cpp
@@ -42,6 +42,7 @@ struct Options : public qpid::Options
bool help;
std::string url;
std::string address;
+ std::string connectionOptions;
int64_t timeout;
bool forever;
qpid::log::Options log;
@@ -59,6 +60,7 @@ struct Options : public qpid::Options
("address,a", qpid::optValue(address, "ADDRESS"), "address to drain from")
("timeout,t", qpid::optValue(timeout, "TIMEOUT"), "timeout in seconds to wait before exiting")
("forever,f", qpid::optValue(forever), "ignore timeout and wait forever")
+ ("connection-options", qpid::optValue(connectionOptions,"OPTIONS"), "connection options string in the form {name1=value1, name2=value2}")
("help", qpid::optValue(help), "print this usage statement");
add(log);
}
@@ -96,7 +98,8 @@ int main(int argc, char** argv)
Options options(argv[0]);
if (options.parse(argc, argv)) {
try {
- Connection connection = Connection::open(options.url);
+ Connection connection(options.connectionOptions);
+ connection.open(options.url);
Session session = connection.newSession();
Receiver receiver = session.createReceiver(options.address);
Duration timeout = options.getTimeout();