From c5cf8abaff0813710b5fdba4a1f6751adbfd0ce9 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 1 Mar 2011 16:23:56 +0000 Subject: QPID-3067: moved old examples to old_api directory git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1075883 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/examples/direct/CMakeLists.txt | 22 -- qpid/cpp/examples/direct/Makefile.am | 47 --- qpid/cpp/examples/direct/declare_queues.cpp | 85 ----- .../examples/direct/direct_declare_queues.vcproj | 394 --------------------- .../examples/direct/direct_direct_producer.vcproj | 394 --------------------- qpid/cpp/examples/direct/direct_listener.vcproj | 394 --------------------- qpid/cpp/examples/direct/direct_producer.cpp | 109 ------ qpid/cpp/examples/direct/listener.cpp | 109 ------ qpid/cpp/examples/direct/verify | 23 -- qpid/cpp/examples/direct/verify.in | 15 - 10 files changed, 1592 deletions(-) delete mode 100644 qpid/cpp/examples/direct/CMakeLists.txt delete mode 100644 qpid/cpp/examples/direct/Makefile.am delete mode 100644 qpid/cpp/examples/direct/declare_queues.cpp delete mode 100644 qpid/cpp/examples/direct/direct_declare_queues.vcproj delete mode 100644 qpid/cpp/examples/direct/direct_direct_producer.vcproj delete mode 100644 qpid/cpp/examples/direct/direct_listener.vcproj delete mode 100644 qpid/cpp/examples/direct/direct_producer.cpp delete mode 100644 qpid/cpp/examples/direct/listener.cpp delete mode 100644 qpid/cpp/examples/direct/verify delete mode 100644 qpid/cpp/examples/direct/verify.in (limited to 'qpid/cpp/examples/direct') diff --git a/qpid/cpp/examples/direct/CMakeLists.txt b/qpid/cpp/examples/direct/CMakeLists.txt deleted file mode 100644 index 2ec1b2b813..0000000000 --- a/qpid/cpp/examples/direct/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -add_example(direct declare_queues) -add_example(direct direct_producer) -add_example(direct listener) diff --git a/qpid/cpp/examples/direct/Makefile.am b/qpid/cpp/examples/direct/Makefile.am deleted file mode 100644 index b07db2cfd6..0000000000 --- a/qpid/cpp/examples/direct/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -examplesdir=$(pkgdatadir)/examples/direct - -MAKELDFLAGS=$(CLIENTFLAGS) -include $(top_srcdir)/examples/makedist.mk - -noinst_PROGRAMS=direct_producer listener declare_queues -direct_producer_SOURCES=direct_producer.cpp -direct_producer_LDADD=$(CLIENT_LIB) - -listener_SOURCES=listener.cpp -listener_LDADD=$(CLIENT_LIB) - -declare_queues_SOURCES=declare_queues.cpp -declare_queues_LDADD=$(CLIENT_LIB) - -examples_DATA= \ - direct_producer.cpp \ - listener.cpp \ - declare_queues.cpp \ - $(MAKEDIST) - -EXTRA_DIST= \ - $(examples_DATA) \ - CMakeLists.txt \ - verify \ - verify.in \ - direct_declare_queues.vcproj \ - direct_direct_producer.vcproj \ - direct_listener.vcproj diff --git a/qpid/cpp/examples/direct/declare_queues.cpp b/qpid/cpp/examples/direct/declare_queues.cpp deleted file mode 100644 index 9a51d1982b..0000000000 --- a/qpid/cpp/examples/direct/declare_queues.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - - -/** - * declare_queues.cpp - * - * This program is one of three programs designed to be used - * together. - * - * declare_queues.cpp: (this program): - * - * 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 - * - * Publishes to the "amq.direct" exchange, specifying the routing - * key "routing_key" - * - * listener.cpp - * - * Reads from the "message_queue" queue on the broker using a - * message listener. - * - */ - -#include -#include - - -using namespace qpid::client; -using namespace qpid::framing; - - -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; - Connection connection; - - try { - connection.open(host, port); - Session session = connection.newSession(); - - - //--------- Main body of program -------------------------------------------- - - // Create a queue named "message_queue", and route all messages whose - // 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"); - - //----------------------------------------------------------------------------- - - connection.close(); - return 0; - } catch(const std::exception& error) { - std::cout << error.what() << std::endl; - } - return 1; - -} - - - diff --git a/qpid/cpp/examples/direct/direct_declare_queues.vcproj b/qpid/cpp/examples/direct/direct_declare_queues.vcproj deleted file mode 100644 index 083474b9ef..0000000000 --- a/qpid/cpp/examples/direct/direct_declare_queues.vcproj +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/examples/direct/direct_direct_producer.vcproj b/qpid/cpp/examples/direct/direct_direct_producer.vcproj deleted file mode 100644 index f091fbf291..0000000000 --- a/qpid/cpp/examples/direct/direct_direct_producer.vcproj +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/examples/direct/direct_listener.vcproj b/qpid/cpp/examples/direct/direct_listener.vcproj deleted file mode 100644 index dce1d3ec28..0000000000 --- a/qpid/cpp/examples/direct/direct_listener.vcproj +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/cpp/examples/direct/direct_producer.cpp b/qpid/cpp/examples/direct/direct_producer.cpp deleted file mode 100644 index ecc9675189..0000000000 --- a/qpid/cpp/examples/direct/direct_producer.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -/** - * direct_producer.cpp: - * - * This program is one of three programs designed to be used - * together. - * - * create_queues.cpp: - * - * 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 (this program): - * - * Publishes to the "amq.direct" exchange, specifying the routing - * key "routing_key" - * - * listener.cpp - * - * Reads from the "message_queue" queue on the broker using a - * message listener. - * - */ - - -#include -#include -#include -#include - - -#include -#include - -#include - -using namespace qpid::client; -using namespace qpid::framing; - -using std::stringstream; -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; - int count = argc>3 ? atoi(argv[3]) : 10; - - Connection connection; - try { - connection.open(host, port); - Session session = connection.newSession(); - - //--------- Main body of program -------------------------------------------- - - // The routing key is a message property. We will use the same - // routing key for each message, so we'll set this property - // just once. (In most simple cases, there is no need to set - // other message properties.) - - Message message; - message.getDeliveryProperties().setRoutingKey("routing_key"); - - // Now send some messages ... - - for (int i=0; i -#include -#include -#include -#include - -#include -#include - -using namespace qpid::client; -using namespace qpid::framing; - - -class Listener : public MessageListener{ - private: - SubscriptionManager& subscriptions; - public: - Listener(SubscriptionManager& subscriptions); - virtual void received(Message& message); -}; - -Listener::Listener(SubscriptionManager& subs) : subscriptions(subs) -{} - -void Listener::received(Message& message) { - std::cout << "Message: " << message.getData() << std::endl; - if (message.getData() == "That's all, folks!") { - std::cout << "Shutting down listener for " << message.getDestination() - << std::endl; - subscriptions.cancel(message.getDestination()); - } -} - -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; - - Connection connection; - - try { - connection.open(host, port); - Session session = connection.newSession(); - - //--------- Main body of program -------------------------------------------- - - SubscriptionManager subscriptions(session); - // Create a listener and subscribe it to the queue named "message_queue" - Listener listener(subscriptions); - subscriptions.subscribe(listener, "message_queue"); - // Receive messages until the subscription is cancelled - // by Listener::received() - subscriptions.run(); - - //--------------------------------------------------------------------------- - - connection.close(); - return 0; - } catch(const std::exception& error) { - std::cout << error.what() << std::endl; - } - return 1; -} - - diff --git a/qpid/cpp/examples/direct/verify b/qpid/cpp/examples/direct/verify deleted file mode 100644 index f598bacc1f..0000000000 --- a/qpid/cpp/examples/direct/verify +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - - -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -clients ./declare_queues ./direct_producer ./listener -outputs ./declare_queues.out ./direct_producer.out ./listener.out diff --git a/qpid/cpp/examples/direct/verify.in b/qpid/cpp/examples/direct/verify.in deleted file mode 100644 index d1e95f1151..0000000000 --- a/qpid/cpp/examples/direct/verify.in +++ /dev/null @@ -1,15 +0,0 @@ -==== declare_queues.out -==== direct_producer.out -==== listener.out -Message: Message 0 -Message: Message 1 -Message: Message 2 -Message: Message 3 -Message: Message 4 -Message: Message 5 -Message: Message 6 -Message: Message 7 -Message: Message 8 -Message: Message 9 -Message: That's all, folks! -Shutting down listener for message_queue -- cgit v1.2.1