summaryrefslogtreecommitdiff
path: root/qpid
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-06-13 13:06:05 +0000
committerAlan Conway <aconway@apache.org>2007-06-13 13:06:05 +0000
commit65da4032319427aa0aab9ec099c09b6dee3cd2dd (patch)
tree18e23c4fe159052878c0a9374b58b28b857c5399 /qpid
parent1460b534c85bc2508a190a89387b3b6b0c0f9634 (diff)
downloadqpid-python-65da4032319427aa0aab9ec099c09b6dee3cd2dd.tar.gz
Example updates from jrobie.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@546858 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
-rw-r--r--qpid/cpp/examples/create_queue.cpp7
-rw-r--r--qpid/cpp/examples/topic_listener.cpp15
2 files changed, 10 insertions, 12 deletions
diff --git a/qpid/cpp/examples/create_queue.cpp b/qpid/cpp/examples/create_queue.cpp
index 28a953806c..e30f40c1f6 100644
--- a/qpid/cpp/examples/create_queue.cpp
+++ b/qpid/cpp/examples/create_queue.cpp
@@ -62,12 +62,11 @@ int main() {
//--------- Main body of program --------------------------------------------
-// ## Alan: can I start the channel first, then declare the queue,
-// or does it need to be in this order?
Queue response("listener");
channel.declareQueue(response);
-
- channel.start();
+ channel.bind(Exchange::STANDARD_TOPIC_EXCHANGE, response, "listener");
+
+ channel.start();
//-----------------------------------------------------------------------------
diff --git a/qpid/cpp/examples/topic_listener.cpp b/qpid/cpp/examples/topic_listener.cpp
index 136a271bf0..3ad32a46cc 100644
--- a/qpid/cpp/examples/topic_listener.cpp
+++ b/qpid/cpp/examples/topic_listener.cpp
@@ -49,7 +49,7 @@
using namespace qpid::client;
using namespace qpid::sys;
-using std::string;
+using namespace std;
bool done = 0;
@@ -70,30 +70,29 @@ int main() {
connection.openChannel(channel);
//--------- Main body of program --------------------------------------------
- Queue response("listener");
- channel.bind(Exchange::STANDARD_DIRECT_EXCHANGE, response, "listener");
+ Queue response("listener");
Listener listener;
string routingKey="listener";
channel.consume(response, routingKey, &listener);
channel.start();
- while (!done)
- ;
+ while (!done)
+ ;
//-----------------------------------------------------------------------------
channel.close();
connection.close();
return 0;
- } catch(qpid::QpidError error) {
- // cout << error.what() << std::endl;
+ } catch(std::exception error) {
+ cout << "Unexpected exception: " << error.what() << endl;
}
return 1;
}
void Listener::received(Message& msg) {
- std::cout << msg.getData();
+ cout << "Message: " << msg.getData() << endl;
if (msg.getData() == "That's all, folks!")
done = 1;
}