diff options
author | Gordon Sim <gsim@apache.org> | 2008-11-13 18:48:43 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-11-13 18:48:43 +0000 |
commit | 74b553b6ef2ccaa18a85c729b00cd0f14233e3b1 (patch) | |
tree | 5b23d095684c1362a4c6c2148b6043472a7d2f04 /qpid/cpp/examples/direct | |
parent | 84cd555a220a48737adb78154de4adbb2ac6d1e1 (diff) | |
download | qpid-python-74b553b6ef2ccaa18a85c729b00cd0f14233e3b1.tar.gz |
Minor cleanup edits to examples (from jrobie@redhat.com)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@713785 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/examples/direct')
-rw-r--r-- | qpid/cpp/examples/direct/declare_queues.cpp | 5 | ||||
-rw-r--r-- | qpid/cpp/examples/direct/direct_producer.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/examples/direct/listener.cpp | 4 |
3 files changed, 4 insertions, 7 deletions
diff --git a/qpid/cpp/examples/direct/declare_queues.cpp b/qpid/cpp/examples/direct/declare_queues.cpp index 07e34007a4..9a51d1982b 100644 --- a/qpid/cpp/examples/direct/declare_queues.cpp +++ b/qpid/cpp/examples/direct/declare_queues.cpp @@ -47,15 +47,10 @@ #include <qpid/client/Connection.h> #include <qpid/client/Session.h> -#include <unistd.h> -#include <cstdlib> -#include <iostream> using namespace qpid::client; using namespace qpid::framing; -using std::string; - int main(int argc, char** argv) { const char* host = argc>1 ? argv[1] : "127.0.0.1"; diff --git a/qpid/cpp/examples/direct/direct_producer.cpp b/qpid/cpp/examples/direct/direct_producer.cpp index 8719fa263f..7cca1955cf 100644 --- a/qpid/cpp/examples/direct/direct_producer.cpp +++ b/qpid/cpp/examples/direct/direct_producer.cpp @@ -68,7 +68,6 @@ int main(int argc, char** argv) { int count = argc>3 ? atoi(argv[3]) : 10; Connection connection; - Message message; try { connection.open(host, port); Session session = connection.newSession(); @@ -80,6 +79,7 @@ int main(int argc, char** argv) { // just once. (In most simple cases, there is no need to set // other message properties.) + Message message; message.getDeliveryProperties().setRoutingKey("routing_key"); // Now send some messages ... diff --git a/qpid/cpp/examples/direct/listener.cpp b/qpid/cpp/examples/direct/listener.cpp index 5fe7138f1e..55229df8a3 100644 --- a/qpid/cpp/examples/direct/listener.cpp +++ b/qpid/cpp/examples/direct/listener.cpp @@ -46,6 +46,7 @@ #include <qpid/client/Connection.h> #include <qpid/client/Session.h> #include <qpid/client/Message.h> +#include <qpid/client/MessageListener.h> #include <qpid/client/SubscriptionManager.h> #include <unistd.h> @@ -79,8 +80,9 @@ void Listener::received(Message& message) { int main(int argc, char** argv) { const char* host = argc>1 ? argv[1] : "127.0.0.1"; int port = argc>2 ? atoi(argv[2]) : 5672; + Connection connection; - Message msg; + try { connection.open(host, port); Session session = connection.newSession(); |