summaryrefslogtreecommitdiff
path: root/cpp/examples/fanout/fanout_producer.cpp
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
commitf6f56f56ebb092d8808119a66ced9fcd0399b238 (patch)
tree3c38eba69b014d53a62f20f92722bed6c1b547d0 /cpp/examples/fanout/fanout_producer.cpp
parentc238bdf224cb3ba37c5fb2de06da7f41e98545a2 (diff)
downloadqpid-python-f6f56f56ebb092d8808119a66ced9fcd0399b238.tar.gz
QPID-1445 patch from Jonathan
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@712699 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/examples/fanout/fanout_producer.cpp')
-rw-r--r--cpp/examples/fanout/fanout_producer.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/cpp/examples/fanout/fanout_producer.cpp b/cpp/examples/fanout/fanout_producer.cpp
index bb253d7027..18338717b9 100644
--- a/cpp/examples/fanout/fanout_producer.cpp
+++ b/cpp/examples/fanout/fanout_producer.cpp
@@ -23,22 +23,21 @@
/**
* fanout_producer.cpp:
*
- * This program is one of three programs designed to be used
- * together. These programs do not specify the exchange type - the
- * default exchange type is the direct exchange.
- *
- * declare_queues.cpp:
- *
- * Creates a queue on a broker, binding a routing key to route
- * messages to that queue.
+ * This program is one of two programs designed to be used
+ * together.
*
* fanout_producer.cpp (this program):
*
- * Publishes to a broker, specifying a routing key.
+ * Publishes messages to the "amq.fanout" exchange.
*
* listener.cpp
*
- * Reads from a queue on the broker using a message listener.
+ * Creates a private queue, binds it to the "amq.fanout"
+ * exchange, and reads messages from its queue as they
+ * arrive. Messages sent before the listener binds the queue are
+ * not received.
+ *
+ * Multiple listeners can run at the same time.
*
*/
@@ -64,7 +63,7 @@ using std::string;
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;
- string exchange = argc>3 ? argv[3] : "amq.fanout";
+
Connection connection;
Message message;
try {
@@ -87,13 +86,13 @@ int main(int argc, char** argv) {
message.setData(message_data.str());
// Asynchronous transfer sends messages as quickly as
// possible without waiting for confirmation.
- async(session).messageTransfer(arg::content=message, arg::destination=exchange);
+ async(session).messageTransfer(arg::content=message, arg::destination="amq.fanout");
}
// And send a final message to indicate termination.
message.setData("That's all, folks!");
- session.messageTransfer(arg::content=message, arg::destination=exchange);
+ session.messageTransfer(arg::content=message, arg::destination="amq.fanout");
//-----------------------------------------------------------------------------