diff options
Diffstat (limited to 'cpp/examples/direct/declare_queues.cpp')
-rw-r--r-- | cpp/examples/direct/declare_queues.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/cpp/examples/direct/declare_queues.cpp b/cpp/examples/direct/declare_queues.cpp index 3289efb872..07e34007a4 100644 --- a/cpp/examples/direct/declare_queues.cpp +++ b/cpp/examples/direct/declare_queues.cpp @@ -19,24 +19,28 @@ * */ + /** * declare_queues.cpp * * This program is one of three programs designed to be used - * together. These programs use the "amq.direct" exchange. + * together. * - * direct_config_queues.cpp (this program): + * declare_queues.cpp: (this program): * - * Creates a queue on a broker, binding a routing key to route - * messages to that queue. + * Creates a queue named "message_queue" on a broker, binding the + * queue to the "amq.direct" exchange, using the routing key + * "routing_key". * - * direct_producer.cpp: + * direct_producer.cpp * - * Publishes to a broker, specifying a routing key. + * Publishes to the "amq.direct" exchange, specifying the routing + * key "routing_key" * - * listener.cpp + * listener.cpp * - * Reads from a queue on the broker using a message listener. + * Reads from the "message_queue" queue on the broker using a + * message listener. * */ @@ -56,7 +60,6 @@ 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.direct"); Connection connection; try { @@ -70,7 +73,7 @@ int main(int argc, char** argv) { // routing key is "routing_key" to this newly created queue. session.queueDeclare(arg::queue="message_queue"); - session.exchangeBind(arg::exchange=exchange, arg::queue="message_queue", arg::bindingKey="routing_key"); + session.exchangeBind(arg::exchange="amq.direct", arg::queue="message_queue", arg::bindingKey="routing_key"); //----------------------------------------------------------------------------- |