You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2007/06/13 15:06:06 UTC
svn commit: r546858 - in /incubator/qpid/trunk/qpid/cpp/examples:
create_queue.cpp topic_listener.cpp
Author: aconway
Date: Wed Jun 13 06:06:05 2007
New Revision: 546858
URL: http://svn.apache.org/viewvc?view=rev&rev=546858
Log:
Example updates from jrobie.
Modified:
incubator/qpid/trunk/qpid/cpp/examples/create_queue.cpp
incubator/qpid/trunk/qpid/cpp/examples/topic_listener.cpp
Modified: incubator/qpid/trunk/qpid/cpp/examples/create_queue.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/create_queue.cpp?view=diff&rev=546858&r1=546857&r2=546858
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/create_queue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/create_queue.cpp Wed Jun 13 06:06:05 2007
@@ -62,12 +62,11 @@
//--------- 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();
//-----------------------------------------------------------------------------
Modified: incubator/qpid/trunk/qpid/cpp/examples/topic_listener.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/topic_listener.cpp?view=diff&rev=546858&r1=546857&r2=546858
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/topic_listener.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/topic_listener.cpp Wed Jun 13 06:06:05 2007
@@ -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 @@
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;
}