summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/examples/Makefile.am12
-rw-r--r--qpid/cpp/examples/examples/direct/direct_config_queues.cpp86
-rw-r--r--qpid/cpp/examples/examples/fanout/fanout_config_queues.cpp86
-rwxr-xr-xqpid/cpp/examples/verify8
4 files changed, 12 insertions, 180 deletions
diff --git a/qpid/cpp/examples/Makefile.am b/qpid/cpp/examples/Makefile.am
index 02d5961fad..9e6e77f37f 100644
--- a/qpid/cpp/examples/Makefile.am
+++ b/qpid/cpp/examples/Makefile.am
@@ -1,11 +1,12 @@
+# List all example files here
nobase_pkgdata_DATA= \
examples/Makefile \
examples/request-response/client.cpp \
examples/request-response/server.cpp \
examples/request-response/Makefile \
examples/fanout/Makefile \
- examples/fanout/fanout_config_queues.cpp \
+ examples/fanout/declare_queues.cpp \
examples/fanout/listener.cpp \
examples/fanout/fanout_publisher.cpp \
examples/pub-sub/Makefile \
@@ -15,7 +16,7 @@ nobase_pkgdata_DATA= \
examples/direct/direct_publisher.cpp \
examples/direct/direct_persistent_config_queues.cpp \
examples/direct/listener.cpp \
- examples/direct/direct_config_queues.cpp \
+ examples/direct/declare_queues.cpp \
examples/direct/direct_persistent_publisher.cpp
EXTRA_DIST=$(nobase_pkgdata_DATA)
@@ -30,20 +31,21 @@ clean-local:
abs_srcdir=@abs_srcdir@
abs_top_builddir=@abs_top_builddir@
+abs_top_srcdir=@abs_top_srcdir@
# Build the examples in the source tree.
all-local:
cd examples && $(MAKE) CXX="$(CXX)" CXXFLAGS="-I../../$(top_srcdir)/src -I../../$(top_srcdir)/src/gen -I../../$(top_builddir)/src/gen -L../../$(top_builddir)/src/.libs -Wl,-rpath,$(abs_top_builddir)/src/.libs" all
-# Verify the examples in the source tree.
+# Verify the examples in the buid tree.
check-local:
- cd examples && QPIDD=$(abs_top_builddir)/src/qpidd ../verify
+ cd examples && QPIDD=$(abs_top_builddir)/src/qpidd $(abs_top_srcdir)/examples/verify
# Build and verify the installed examples, then clean up to avoid rpmbuild warnings.
EXAMPLE_FLAGS=-I$(DESTDIR)$(includedir) -L$(DESTDIR)$(libdir) -Wl,-rpath,$(DESTDIR)$(libdir)
EXAMPLE_DIR=$(DESTDIR)$(pkgdatadir)/examples
installcheck-local:
cd $(EXAMPLE_DIR) && $(MAKE) CXX="$(CXX)" CXXFLAGS="$(EXAMPLE_FLAGS)" all
- cd $(EXAMPLE_DIR) && QPIDD=$(top_builddir)/src/qpidd $(abs_srcdir)/verify
+ cd $(EXAMPLE_DIR) && QPIDD=$(DESTDIR)$(sbindir)/qpidd $(abs_srcdir)/verify
cd $(EXAMPLE_DIR) && $(MAKE) clean
diff --git a/qpid/cpp/examples/examples/direct/direct_config_queues.cpp b/qpid/cpp/examples/examples/direct/direct_config_queues.cpp
deleted file mode 100644
index 3a52d4f62f..0000000000
--- a/qpid/cpp/examples/examples/direct/direct_config_queues.cpp
+++ /dev/null
@@ -1,86 +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_config_queues.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.
- *
- * direct_config_queues.cpp (this program):
- *
- * Creates a queue on a broker, binding a routing key to route
- * messages to that queue.
- *
- * direct_publisher.cpp:
- *
- * Publishes to a broker, specifying a routing key.
- *
- * direct_listener.cpp
- *
- * Reads from a queue on the broker using a message listener.
- *
- */
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-using std::string;
-
-
-int main() {
- Connection connection;
- Message msg;
- try {
- connection.open("127.0.0.1", 5672);
- 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.queueBind(arg::queue="message_queue", arg::routingKey="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/examples/fanout/fanout_config_queues.cpp b/qpid/cpp/examples/examples/fanout/fanout_config_queues.cpp
deleted file mode 100644
index b09b5191d1..0000000000
--- a/qpid/cpp/examples/examples/fanout/fanout_config_queues.cpp
+++ /dev/null
@@ -1,86 +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_config_queues.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.
- *
- * direct_config_queues.cpp (this program):
- *
- * Creates a queue on a broker, binding a routing key to route
- * messages to that queue.
- *
- * direct_publisher.cpp:
- *
- * Publishes to a broker, specifying a routing key.
- *
- * direct_listener.cpp
- *
- * Reads from a queue on the broker using a message listener.
- *
- */
-
-#include <qpid/client/Connection.h>
-#include <qpid/client/Session.h>
-
-#include <unistd.h>
-#include <cstdlib>
-#include <iostream>
-
-using namespace qpid::client;
-using namespace qpid::framing;
-
-using std::string;
-
-
-int main() {
- Connection connection;
- Message msg;
- try {
- connection.open("127.0.0.1", 5672);
- 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.queueBind(arg::queue="message_queue", arg::exchange="amq.fanout");
-
-
- //-----------------------------------------------------------------------------
-
- connection.close();
- return 0;
- } catch(const std::exception& error) {
- std::cout << error.what() << std::endl;
- }
- return 1;
-
-}
-
-
-
diff --git a/qpid/cpp/examples/verify b/qpid/cpp/examples/verify
index 695a1ee3e7..b53afe470d 100755
--- a/qpid/cpp/examples/verify
+++ b/qpid/cpp/examples/verify
@@ -8,8 +8,10 @@ SRC=`dirname $0 | sed 's|^\([^/].*\)|'$PWD'/\1|'`/examples
# Start private broker if QPIDD is set.
if [ -n "$QPIDD" ] ; then
- QPID_PORT=`$QPIDD -dp0` || { echo "Cannot start $QPIDD" ; exit 1; }
- export QPID_PORT
+ # FIXME aconway 2007-12-14: Should use --port 0, need
+ # to make examples clients more flexible to connect.
+ #
+ $QPIDD -d || { echo "Cannot start $QPIDD" ; exit 1; }
trap "$QPIDD -q" EXIT
fi
@@ -73,7 +75,7 @@ request_response() {
# FIXME aconway 2007-12-14: put back pub-sub and persistence when fixed.
# Main
-for ex in direct fanout request-response ; do
+for ex in direct fanout request-response ; do
func=`echo $ex | tr - _`
echo "Verifing $ex"
( cd $ex && $func && verify && rm -f *.out *.wait)