summaryrefslogtreecommitdiff
path: root/cpp/examples/messaging
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
commite74eaed0bc3665bc38d7cbedce85f85536f92824 (patch)
treef55ff48efa8e2b43c3bf3e0f1d4003b4d7fbe88f /cpp/examples/messaging
parenta5318490afdca4c9a16329f2a0e2f9ded0813f36 (diff)
downloadqpid-python-e74eaed0bc3665bc38d7cbedce85f85536f92824.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/qpid@904000 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/examples/messaging')
-rw-r--r--cpp/examples/messaging/client.cpp3
-rw-r--r--cpp/examples/messaging/drain.cpp5
-rw-r--r--cpp/examples/messaging/map_receiver.cpp3
-rw-r--r--cpp/examples/messaging/map_sender.cpp3
-rw-r--r--cpp/examples/messaging/queue_receiver.cpp5
-rw-r--r--cpp/examples/messaging/queue_sender.cpp3
-rw-r--r--cpp/examples/messaging/server.cpp3
-rw-r--r--cpp/examples/messaging/spout.cpp5
-rw-r--r--cpp/examples/messaging/topic_receiver.cpp3
-rw-r--r--cpp/examples/messaging/topic_sender.cpp3
10 files changed, 24 insertions, 12 deletions
diff --git a/cpp/examples/messaging/client.cpp b/cpp/examples/messaging/client.cpp
index 49d5441bf0..4d68d7c575 100644
--- a/cpp/examples/messaging/client.cpp
+++ b/cpp/examples/messaging/client.cpp
@@ -40,7 +40,8 @@ int main(int argc, char** argv) {
const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672";
try {
- Connection connection = Connection::open(url);
+ Connection connection;
+ connection.open(url);
Session session = connection.newSession();
Sender sender = session.createSender("service_queue");
diff --git a/cpp/examples/messaging/drain.cpp b/cpp/examples/messaging/drain.cpp
index 3834aa3dfd..21c7df7388 100644
--- a/cpp/examples/messaging/drain.cpp
+++ b/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();
diff --git a/cpp/examples/messaging/map_receiver.cpp b/cpp/examples/messaging/map_receiver.cpp
index 0106ce878c..05be4090d2 100644
--- a/cpp/examples/messaging/map_receiver.cpp
+++ b/cpp/examples/messaging/map_receiver.cpp
@@ -39,7 +39,8 @@ int main(int argc, char** argv) {
const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672";
try {
- Connection connection = Connection::open(url);
+ Connection connection;
+ connection.open(url);
Session session = connection.newSession();
Receiver receiver = session.createReceiver("message_queue");
Message message = receiver.fetch();
diff --git a/cpp/examples/messaging/map_sender.cpp b/cpp/examples/messaging/map_sender.cpp
index 50150fa3d5..b6e0621844 100644
--- a/cpp/examples/messaging/map_sender.cpp
+++ b/cpp/examples/messaging/map_sender.cpp
@@ -39,7 +39,8 @@ int main(int argc, char** argv) {
const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672";
try {
- Connection connection = Connection::open(url);
+ Connection connection;
+ connection.open(url);
Session session = connection.newSession();
Sender sender = session.createSender("message_queue");
diff --git a/cpp/examples/messaging/queue_receiver.cpp b/cpp/examples/messaging/queue_receiver.cpp
index 058a4e19ae..192b90088d 100644
--- a/cpp/examples/messaging/queue_receiver.cpp
+++ b/cpp/examples/messaging/queue_receiver.cpp
@@ -32,9 +32,8 @@ int main(int argc, char** argv) {
const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672";
try {
- Variant::Map options;
- if (argc>2) parseOptionString(argv[2], options);
- Connection connection = Connection::open(url, options);
+ Connection connection;
+ connection.open(url);
Session session = connection.newSession();
Receiver receiver = session.createReceiver("message_queue");
while (true) {
diff --git a/cpp/examples/messaging/queue_sender.cpp b/cpp/examples/messaging/queue_sender.cpp
index 1396e26d5c..b2535d90bf 100644
--- a/cpp/examples/messaging/queue_sender.cpp
+++ b/cpp/examples/messaging/queue_sender.cpp
@@ -35,7 +35,8 @@ int main(int argc, char** argv) {
int count = argc>2 ? atoi(argv[2]) : 10;
try {
- Connection connection = Connection::open(url);
+ Connection connection;
+ connection.open(url);
Session session = connection.newSession();
Sender sender = session.createSender("message_queue");
diff --git a/cpp/examples/messaging/server.cpp b/cpp/examples/messaging/server.cpp
index 137323dd03..0a80a5fb02 100644
--- a/cpp/examples/messaging/server.cpp
+++ b/cpp/examples/messaging/server.cpp
@@ -42,7 +42,8 @@ int main(int argc, char** argv) {
const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672";
try {
- Connection connection = Connection::open(url);
+ Connection connection;
+ connection.open(url);
Session session = connection.newSession();
Receiver receiver = session.createReceiver("service_queue; {create: always}");
diff --git a/cpp/examples/messaging/spout.cpp b/cpp/examples/messaging/spout.cpp
index 62d72a8043..cbb6b52b34 100644
--- a/cpp/examples/messaging/spout.cpp
+++ b/cpp/examples/messaging/spout.cpp
@@ -56,6 +56,7 @@ struct Options : public qpid::Options
string_vector properties;
string_vector entries;
std::string content;
+ std::string connectionOptions;
qpid::log::Options log;
Options(const std::string& argv0=std::string())
@@ -76,6 +77,7 @@ struct Options : public qpid::Options
("property,P", qpid::optValue(properties, "NAME=VALUE"), "specify message property")
("map,M", qpid::optValue(entries, "NAME=VALUE"), "specify entry for map content")
("content", qpid::optValue(content, "CONTENT"), "specify textual content")
+ ("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);
}
@@ -155,7 +157,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();
Sender sender = session.createSender(options.address);
diff --git a/cpp/examples/messaging/topic_receiver.cpp b/cpp/examples/messaging/topic_receiver.cpp
index 321231f93d..13f881e574 100644
--- a/cpp/examples/messaging/topic_receiver.cpp
+++ b/cpp/examples/messaging/topic_receiver.cpp
@@ -35,7 +35,8 @@ int main(int argc, char** argv) {
const std::string pattern = argc>2 ? argv[2] : "#.#";
try {
- Connection connection = Connection::open(url);
+ Connection connection;
+ connection.open(url);
Session session = connection.newSession();
Receiver receiver = session.createReceiver("news_service; {filter:[control, " + pattern + "]}");
while (true) {
diff --git a/cpp/examples/messaging/topic_sender.cpp b/cpp/examples/messaging/topic_sender.cpp
index 5665fc45f9..d1ada45864 100644
--- a/cpp/examples/messaging/topic_sender.cpp
+++ b/cpp/examples/messaging/topic_sender.cpp
@@ -52,7 +52,8 @@ int main(int argc, char** argv) {
int count = argc>2 ? atoi(argv[2]) : 10;
try {
- Connection connection = Connection::open(url);
+ Connection connection;
+ connection.open(url);
Session session = connection.newSession();
Sender sender = session.createSender("news_service");