summaryrefslogtreecommitdiff
path: root/qpid/cpp/examples/xml-exchange
diff options
context:
space:
mode:
authorCarl C. Trieloff <cctrieloff@apache.org>2008-11-10 17:05:41 +0000
committerCarl C. Trieloff <cctrieloff@apache.org>2008-11-10 17:05:41 +0000
commit781469828700c05fb48c92afd2acb9572b66eb32 (patch)
treeee8f6de9a6269cc9a90d468dd7d6677ac7c501db /qpid/cpp/examples/xml-exchange
parentbc19bc82db70ee8d9335090e9283d764606c067f (diff)
downloadqpid-python-781469828700c05fb48c92afd2acb9572b66eb32.tar.gz
QPID-1445 patch from Jonathan
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@712699 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/examples/xml-exchange')
-rw-r--r--qpid/cpp/examples/xml-exchange/declare_queues.cpp25
-rw-r--r--qpid/cpp/examples/xml-exchange/listener.cpp23
-rw-r--r--qpid/cpp/examples/xml-exchange/xml_producer.cpp25
3 files changed, 69 insertions, 4 deletions
diff --git a/qpid/cpp/examples/xml-exchange/declare_queues.cpp b/qpid/cpp/examples/xml-exchange/declare_queues.cpp
index 1307c473c5..d3a0f539b6 100644
--- a/qpid/cpp/examples/xml-exchange/declare_queues.cpp
+++ b/qpid/cpp/examples/xml-exchange/declare_queues.cpp
@@ -19,6 +19,29 @@
*
*/
+
+/**
+ *
+ * declare_queues.cpp
+ *
+ * This is one of three programs used to implement XML-based content
+ * routing in C++.
+ *
+ * declare_queues.cpp (this program)
+ *
+ * Creates a queue named "message_qaueue" on the broker,
+ * declares an XML Exchange, subscribes the queue to the XML
+ * Exchange using an XQuery in the binding, then exits.
+ *
+ * xml_producer.cpp
+ *
+ * Publishes messages to the XML Exchange.
+ *
+ * listener.cpp
+ *
+ * Reads messages from the "message_queue" queue.
+ */
+
#include <qpid/client/Connection.h>
#include <qpid/client/Session.h>
@@ -59,7 +82,7 @@ int main(int argc, char** argv) {
FieldTable binding;
binding.setString("xquery", "declare variable $control external;"
"./message/id mod 2 = 1 or $control = 'end'");
- session.exchangeBind(arg::exchange="xml", arg::queue="message_queue", arg::bindingKey="query_name", arg::arguments=binding);
+ session.exchangeBind(arg::exchange="xml", arg::queue="message_queue", arg::bindingKey="content_feed", arg::arguments=binding);
//-----------------------------------------------------------------------------
diff --git a/qpid/cpp/examples/xml-exchange/listener.cpp b/qpid/cpp/examples/xml-exchange/listener.cpp
index 94cd1670e5..2c9a1e7a55 100644
--- a/qpid/cpp/examples/xml-exchange/listener.cpp
+++ b/qpid/cpp/examples/xml-exchange/listener.cpp
@@ -19,11 +19,30 @@
*
*/
+
/**
- * listener.cpp: This program reads messages fro a queue on
- * the broker using a message listener.
+ *
+ * listener.cpp
+ *
+ * This is one of three programs used to implement XML-based content
+ * routing in C++.
+ *
+ * declare_queues.cpp
+ *
+ * Creates a queue named "message_qaueue" on the broker,
+ * declares an XML Exchange, subscribes the queue to the XML
+ * Exchange using an XQuery in the binding, then exits.
+ *
+ * xml_producer.cpp
+ *
+ * Publishes messages to the XML Exchange.
+ *
+ * listener.cpp (this program)
+ *
+ * Reads messages from the "message_queue" queue.
*/
+
#include <qpid/client/Connection.h>
#include <qpid/client/Session.h>
#include <qpid/client/Message.h>
diff --git a/qpid/cpp/examples/xml-exchange/xml_producer.cpp b/qpid/cpp/examples/xml-exchange/xml_producer.cpp
index 19889e4891..5cb75d0087 100644
--- a/qpid/cpp/examples/xml-exchange/xml_producer.cpp
+++ b/qpid/cpp/examples/xml-exchange/xml_producer.cpp
@@ -20,6 +20,29 @@
*/
+/**
+ *
+ * xml_producer.cpp
+ *
+ * This is one of three programs used to implement XML-based content
+ * routing in C++.
+ *
+ * declare_queues.cpp
+ *
+ * Creates a queue named "message_qaueue" on the broker,
+ * declares an XML Exchange, subscribes the queue to the XML
+ * Exchange using an XQuery in the binding, then exits.
+ *
+ * xml_producer.cpp (this program)
+ *
+ * Publishes messages to the XML Exchange.
+ *
+ * listener.cpp
+ *
+ * Reads messages from the "message_queue" queue.
+ */
+
+
#include <qpid/client/Connection.h>
#include <qpid/client/Session.h>
#include <qpid/client/AsyncSession.h>
@@ -55,7 +78,7 @@ int main(int argc, char** argv) {
// In the XML exchange, the routing key and the name of
// the query match.
- message.getDeliveryProperties().setRoutingKey("query_name");
+ message.getDeliveryProperties().setRoutingKey("content_feed");
message.getHeaders().setString("control","continue");
// Now send some messages ...