summaryrefslogtreecommitdiff
path: root/qpid/cpp/examples/direct
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2008-10-24 00:45:11 +0000
committerTed Ross <tross@apache.org>2008-10-24 00:45:11 +0000
commitd33da71d0e2dbf23345c6bd45895eb918739c0c5 (patch)
treef820c248a9aa8bae3826811bb9fca8d970e993f5 /qpid/cpp/examples/direct
parent8a17f96b1254b5a827726e892edaf373d00dd0b8 (diff)
downloadqpid-python-d33da71d0e2dbf23345c6bd45895eb918739c0c5.tar.gz
QPID-1348 - Dynamic binding for federation. Parameterized exchange names for CPP examples
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@707515 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/examples/direct')
-rw-r--r--qpid/cpp/examples/direct/declare_queues.cpp3
-rw-r--r--qpid/cpp/examples/direct/direct_producer.cpp7
2 files changed, 6 insertions, 4 deletions
diff --git a/qpid/cpp/examples/direct/declare_queues.cpp b/qpid/cpp/examples/direct/declare_queues.cpp
index 0cdb472665..3289efb872 100644
--- a/qpid/cpp/examples/direct/declare_queues.cpp
+++ b/qpid/cpp/examples/direct/declare_queues.cpp
@@ -56,6 +56,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.direct");
Connection connection;
try {
@@ -69,7 +70,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="amq.direct", arg::queue="message_queue", arg::bindingKey="routing_key");
+ session.exchangeBind(arg::exchange=exchange, arg::queue="message_queue", arg::bindingKey="routing_key");
//-----------------------------------------------------------------------------
diff --git a/qpid/cpp/examples/direct/direct_producer.cpp b/qpid/cpp/examples/direct/direct_producer.cpp
index baa8d9092b..9ea3c812a6 100644
--- a/qpid/cpp/examples/direct/direct_producer.cpp
+++ b/qpid/cpp/examples/direct/direct_producer.cpp
@@ -65,6 +65,7 @@ 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;
int count = argc>3 ? atoi(argv[3]) : 10;
+ string exchange(argc>4 ? argv[4] : "amq.direct");
Connection connection;
Message message;
try {
@@ -89,14 +90,14 @@ 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="amq.direct");
- session.messageTransfer(arg::content=message, arg::destination="amq.direct");
+ // async(session).messageTransfer(arg::content=message, arg::destination=exchange);
+ session.messageTransfer(arg::content=message, arg::destination=exchange);
}
// And send a final message to indicate termination.
message.setData("That's all, folks!");
- session.messageTransfer(arg::content=message, arg::destination="amq.direct");
+ session.messageTransfer(arg::content=message, arg::destination=exchange);
//-----------------------------------------------------------------------------