You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ai...@apache.org on 2008/02/13 12:44:53 UTC
svn commit: r627359 [1/2] - in /incubator/qpid/branches/thegreatmerge: ./
qpid/bin/ qpid/cpp/ qpid/cpp/examples/ qpid/cpp/examples/examples/direct/
qpid/cpp/examples/examples/fanout/ qpid/cpp/examples/examples/pub-sub/
qpid/cpp/examples/examples/reques...
Author: aidan
Date: Wed Feb 13 03:44:34 2008
New Revision: 627359
URL: http://svn.apache.org/viewvc?rev=627359&view=rev
Log:
Merged revisions 619974,620011,620014,620016-620017,620479,620481,620566,620584,620619,620622,620831,620854,620861-620862,620889,627128,627133,627141,627153-627155,627157,627171,627187 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/trunk
........
r619974 | rhs | 2008-02-08 18:30:04 +0000 (Fri, 08 Feb 2008) | 1 line
made xa tests run, and made QpidTestCase more robust
........
r620011 | rhs | 2008-02-08 22:05:50 +0000 (Fri, 08 Feb 2008) | 1 line
whitespace cleanup
........
r620014 | aconway | 2008-02-08 22:23:23 +0000 (Fri, 08 Feb 2008) | 7 lines
cpp/examples/direct, fanout: Converted listener.cpp to SubscriptionManager.
All python/cpp combos run as part of cpp/examples make check.
Fixed problems with verify scripts and VPATH builds.
........
r620016 | cctrieloff | 2008-02-08 22:24:33 +0000 (Fri, 08 Feb 2008) | 2 lines
yum correction
........
r620017 | aconway | 2008-02-08 22:27:38 +0000 (Fri, 08 Feb 2008) | 10 lines
From Ted Ross, https://issues.apache.org/jira/browse/QPID-782
The attached patch makes the following changes:
The --load-dir option has been renamed to --module-dir
The --no-modules option and been replaced by the --no-module-dir option. This new option suppresses ONLY the loading of modules from the directory.
The --no-data-dir option has been added to suppress the use of a data directory.
Logging has been added for data directory lock and unlock.
........
r620479 | gsim | 2008-02-11 13:00:45 +0000 (Mon, 11 Feb 2008) | 3 lines
Check valid listener (or handler) exist and log error if not. See QPID-783.
........
r620481 | gsim | 2008-02-11 13:10:38 +0000 (Mon, 11 Feb 2008) | 3 lines
Added a test (currently disabled) that highlights a deadlock in the client when commands are sent to the broker concurrently with acks (e.g. when the dispatcher thread is running with auto-acking and messages are sent on another thread).
........
r620566 | rhs | 2008-02-11 18:23:12 +0000 (Mon, 11 Feb 2008) | 1 line
bumped release for Beta 3
........
r620584 | rhs | 2008-02-11 19:21:01 +0000 (Mon, 11 Feb 2008) | 1 line
fixed computation of ranged acks, fix needed for failing RecoverTest
........
r620619 | aconway | 2008-02-11 21:43:32 +0000 (Mon, 11 Feb 2008) | 1 line
Fix errors in verify scripts.
........
r620622 | aconway | 2008-02-11 21:50:17 +0000 (Mon, 11 Feb 2008) | 1 line
Remove dependency on sys::Socket for management ID of connections.
........
r620831 | rhs | 2008-02-12 15:44:14 +0000 (Tue, 12 Feb 2008) | 1 line
added help text for the clean-results target
........
r620854 | gsim | 2008-02-12 16:35:45 +0000 (Tue, 12 Feb 2008) | 3 lines
Explicitly reset shared pointer; brokers destructor not called if started through -d otherwise it seems...
........
r620861 | gsim | 2008-02-12 16:54:05 +0000 (Tue, 12 Feb 2008) | 3 lines
Fixed typo
........
r620862 | aconway | 2008-02-12 16:54:42 +0000 (Tue, 12 Feb 2008) | 2 lines
Create /var/lib/qpidd correctly.
........
r620889 | aconway | 2008-02-12 18:04:11 +0000 (Tue, 12 Feb 2008) | 1 line
Quote all non-printable ASCII characters (not just control characters)
........
r627128 | aconway | 2008-02-12 21:39:55 +0000 (Tue, 12 Feb 2008) | 1 line
Create a tar file of verify scripts suitable for untarring into and installed examples directory.
........
r627133 | aconway | 2008-02-12 21:48:52 +0000 (Tue, 12 Feb 2008) | 2 lines
Add -g to build flags to get debug info.
........
r627141 | aconway | 2008-02-12 21:57:36 +0000 (Tue, 12 Feb 2008) | 2 lines
Fix verify error in Makefile.am
........
r627153 | rhs | 2008-02-12 22:21:20 +0000 (Tue, 12 Feb 2008) | 1 line
increased the test timeout
........
r627154 | rhs | 2008-02-12 22:22:20 +0000 (Tue, 12 Feb 2008) | 1 line
synchronize access to lastWrite future
........
r627155 | rhs | 2008-02-12 22:23:02 +0000 (Tue, 12 Feb 2008) | 1 line
added default getConnection()
........
r627157 | rhs | 2008-02-12 22:26:26 +0000 (Tue, 12 Feb 2008) | 1 line
added a test for message send followed by immediate connection close; fixed connection close handshaking
........
r627171 | aconway | 2008-02-12 23:09:06 +0000 (Tue, 12 Feb 2008) | 6 lines
Patches from Ted Ross:
Fix for bignumber problem in the management console.
Fix for broker crash when sessions are closed via management.
........
r627187 | rhs | 2008-02-12 23:52:01 +0000 (Tue, 12 Feb 2008) | 1 line
applied patch from rajith to fix reply-to
........
Added:
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_python_cpp.in
- copied unchanged from r627187, incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify_python_cpp.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_python_cpp.in
- copied unchanged from r627187, incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify_python_cpp.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/verify_all
- copied unchanged from r627187, incubator/qpid/trunk/qpid/cpp/examples/verify_all
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java
- copied unchanged from r627187, incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/AbstractXATestCase.java
- copied unchanged from r627187, incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/AbstractXATestCase.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/QueueTest.java
- copied unchanged from r627187, incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/QueueTest.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/TopicTest.java
- copied unchanged from r627187, incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/TopicTest.java
Removed:
incubator/qpid/branches/thegreatmerge/qpid/bin/verify_all
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/AbstractXATest.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/QueueTests.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/test/unit/xa/TopicTests.java
Modified:
incubator/qpid/branches/thegreatmerge/ (props changed)
incubator/qpid/branches/thegreatmerge/qpid/bin/verify
incubator/qpid/branches/thegreatmerge/qpid/cpp/README
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/Makefile.am
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/listener.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/declare_queues.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/fanout_producer.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/listener.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_python_cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_python_cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/qpidc.spec.in
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/DataDir.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.h
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.h
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/SessionState.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/client/Dispatcher.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/log/Statement.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/management/ManagementAgent.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpidd.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/ClientSessionTest.cpp
incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/logging.cpp
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java
incubator/qpid/branches/thegreatmerge/qpid/java/common.xml
incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java
incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java
incubator/qpid/branches/thegreatmerge/qpid/java/module.xml
incubator/qpid/branches/thegreatmerge/qpid/python/examples/direct/verify.in
incubator/qpid/branches/thegreatmerge/qpid/python/examples/fanout/verify.in
incubator/qpid/branches/thegreatmerge/qpid/python/examples/pubsub/verify.in
incubator/qpid/branches/thegreatmerge/qpid/python/examples/request-response/verify.in
incubator/qpid/branches/thegreatmerge/qpid/python/tests_0-10/message.py
Propchange: incubator/qpid/branches/thegreatmerge/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 13 03:44:34 2008
@@ -1 +1 @@
-/incubator/qpid/branches/M2.1:1-615948 /incubator/qpid/trunk:1-619941
+/incubator/qpid/branches/M2.1:1-615948 /incubator/qpid/trunk:1-627358
Modified: incubator/qpid/branches/thegreatmerge/qpid/bin/verify
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/bin/verify?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/bin/verify (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/bin/verify Wed Feb 13 03:44:34 2008
@@ -36,11 +36,16 @@
waitfor $out "$pattern"
}
+name() {
+ for x in $*; do name="$name `basename $x`"; done
+ echo $name;
+}
+
outputs() {
wait 2> /dev/null # Wait for all backgroud processes to complete
rm -f $script.out
for f in "$@"; do
- { echo "==== $f"; eval "cat $f"; } >> $script.out || fail
+ { echo "==== `name $f`"; eval "cat $f"; } >> $script.out || fail
done
}
@@ -49,6 +54,7 @@
if [ -d $1 ]; then dir=$1; script=verify;
else dir=`dirname $1`; script=`basename $1`; fi
cd $dir || return 1
+ rm -f *.out
{ source ./$script && diff -ac $script.out $script.in ; } || fail
test -z "$FAIL" && rm -f *.out
return $FAIL
@@ -59,7 +65,7 @@
sed "s/$HEX\{8\}-$HEX\{4\}-$HEX\{4\}-$HEX\{4\}-$HEX\{12\}//g" $*
}
remove_uuid64() {
- sed 's/[-A-Za-z0-9_]\{22\}==$//' $*
+ sed 's/[-A-Za-z0-9_]\{22\}==//g' $*
}
# Start private broker if QPIDD is set.
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/README
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/README?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/README (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/README Wed Feb 13 03:44:34 2008
@@ -60,7 +60,7 @@
On linux most packages can be installed using your distribution's package
management tool. For example on Fedora:
- # yum install pkgconfig e2fsprogs boost-devel cppunit-devel openais ruby
+ # yum install pkgconfig e2fsprogs boost-devel cppunit-devel openais-devel ruby
# yum install make gcc-c++ autoconf automake libtool doxygen help2man graphviz
# yum install e2fsprogs-devel
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/Makefile.am?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/Makefile.am (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/Makefile.am Wed Feb 13 03:44:34 2008
@@ -17,7 +17,36 @@
examples/direct/listener.cpp \
examples/direct/declare_queues.cpp
-EXTRA_DIST=$(nobase_pkgdata_DATA)
+VERIFY_FILES= verify verify_all \
+ examples/request-response/verify \
+ examples/request-response/verify.in \
+ examples/request-response/verify_cpp_python \
+ examples/request-response/verify_cpp_python.in \
+ examples/request-response/verify_python_cpp \
+ examples/request-response/verify_python_cpp.in \
+ examples/fanout/verify \
+ examples/fanout/verify.in \
+ examples/fanout/verify_cpp_python \
+ examples/fanout/verify_cpp_python.in \
+ examples/fanout/verify_python_cpp \
+ examples/fanout/verify_python_cpp.in \
+ examples/pub-sub/verify \
+ examples/pub-sub/verify.in \
+ examples/pub-sub/verify_cpp_python \
+ examples/pub-sub/verify_cpp_python.in \
+ examples/pub-sub/verify_python_cpp \
+ examples/pub-sub/verify_python_cpp.in \
+ examples/direct/verify \
+ examples/direct/verify.in \
+ examples/direct/verify_cpp_python \
+ examples/direct/verify_cpp_python.in \
+ examples/direct/verify_python_cpp \
+ examples/direct/verify_python_cpp.in
+
+EXTRA_DIST=$(nobase_pkgdata_DATA) $(VERIFY_FILES)
+
+verify:
+ cp $(top_srcdir)/../bin/verify $@
# Note: we don't use normal automake SUBDIRS because the example
# makefiles don't understand all the recursive automake targets.
@@ -29,31 +58,23 @@
abs_top_builddir=@abs_top_builddir@
abs_top_srcdir=@abs_top_srcdir@
-VERIFY=$(top_srcdir)/../bin/verify
-PYTHON_EXAMPLES=$(top_srcdir)/../python/examples
-EXAMPLES= \
- examples/pub-sub \
- examples/fanout \
- examples/direct \
- examples/request-response \
- $(PYTHON_EXAMPLES)/pubsub \
- $(PYTHON_EXAMPLES)/fanout \
- $(PYTHON_EXAMPLES)/direct \
- $(PYTHON_EXAMPLES)/request-response
-
-# Build the examples in the source tree.
+# Build the examples - copy sources to the build tree in VPATH build.
all-local:
+ test -d examples || cp -R $(srcdir)/examples .
cd examples && $(MAKE) CXX="$(CXX)" CXXFLAGS="$(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 buid tree.
-check-local: all-local
- QPID_DATA_DIR= QPIDD=$(top_builddir)/src/qpidd $(VERIFY) $(EXAMPLES)
+check-local: all-local verify
+ $(srcdir)/verify_all $(abs_top_srcdir) $(abs_top_builddir)
-# 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=$(sbindir)/qpidd $(VERIFY)
- cd $(EXAMPLE_DIR) && $(MAKE) clean
+# TODO:
+# create a tarball for testing installed examples.
+# installcheck-local to use the tarball on installed example and clean up after.
+# Build and verify installed C++ examples, clean up to avoid rpmbuild warnings.
+# EXAMPLE_FLAGS=-I$(DESTDIR)$(includedir) -L$(DESTDIR)$(libdir) -Wl,-rpath,$(DESTDIR)$(libdir)
+# EXAMPLE_DIR=$(DESTDIR)$(pkgdatadir)/examples/cpp
+# installcheck-local:
+# cd $(EXAMPLE_DIR) && $(MAKE) CXX="$(CXX)" CXXFLAGS="$(EXAMPLE_FLAGS)" all
+# cd $(EXAMPLE_DIR) && QPIDD=$(sbindir)/qpidd $(srcdir)/verify *
+# cd $(EXAMPLE_DIR) && $(MAKE) clean
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/listener.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/listener.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/listener.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/listener.cpp Wed Feb 13 03:44:34 2008
@@ -20,32 +20,15 @@
*/
/**
- * listener.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.
- *
- * direct_producer.cpp:
- *
- * Publishes to a broker, specifying a routing key.
- *
- * listener.cpp (this program):
- *
- * Reads from a queue on the broker using a message listener.
- *
+ * listener.cpp: This program reads messages fro a queue on
+ * the broker using a message listener.
*/
#include <qpid/client/Dispatcher.h>
#include <qpid/client/Connection.h>
#include <qpid/client/Session.h>
#include <qpid/client/Message.h>
-#include <qpid/client/MessageListener.h>
+#include <qpid/client/SubscriptionManager.h>
#include <unistd.h>
#include <cstdlib>
@@ -56,42 +39,25 @@
class Listener : public MessageListener{
-private:
- std::string destination_name;
- Dispatcher dispatcher;
-public:
- Listener(Session& session, string destination_name):
- destination_name(destination_name),
- dispatcher(session)
- {};
-
- virtual void listen();
- virtual void received(Message& message);
- ~Listener() { };
+ private:
+ SubscriptionManager& subscriptions;
+ public:
+ Listener(SubscriptionManager& subscriptions);
+ virtual void received(Message& message);
};
-
-void Listener::listen() {
- std::cout << "Activating listener for: " <<destination_name << std::endl;
- dispatcher.listen(destination_name, this);
-
- // The following line gives up control
-
- dispatcher.run();
-}
-
+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 " <<destination_name << std::endl;
- dispatcher.stop();
+ 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;
@@ -103,25 +69,15 @@
//--------- 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");
+ // Deliver messages until the subscription is cancelled
+ // by Listener::received()
+ subscriptions.run();
- // Subscribe to the queue, route it to a client destination for
- // the listener. (The destination name merely identifies the
- // destination in the listener, you can use any name as long as
- // you use the same name for the listener).
-
- session.messageSubscribe(arg::queue="message_queue", arg::destination="listener_destination");
-
- //##############
- session.messageFlow(arg::destination="listener_destination", arg::unit=0, arg::value=1);//messages ### Define a constant?
- session.messageFlow(arg::destination="listener_destination", arg::unit=1, arg::value=0xFFFFFFFF);//bytes ###### Define a constant?
-
- // Tell the listener to listen to the destination we just
- // created above.
-
- Listener listener(session, "listener_destination");
- listener.listen();
-
- //-----------------------------------------------------------------------------
+ //---------------------------------------------------------------------------
connection.close();
return 0;
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify.in Wed Feb 13 03:44:34 2008
@@ -1,7 +1,6 @@
-==== ./declare_queues.out
-==== ./direct_producer.out
-==== ./listener.out
-Activating listener for: listener_destination
+==== declare_queues.out
+==== direct_producer.out
+==== listener.out
Message: Message 0
Message: Message 1
Message: Message 2
@@ -13,4 +12,4 @@
Message: Message 8
Message: Message 9
Message: That's all, folks!
-Shutting down listener for listener_destination
+Shutting down listener for message_queue
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python Wed Feb 13 03:44:34 2008
@@ -1,4 +1,4 @@
# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=../../../../python/examples/direct
+py=$PYTHON_EXAMPLES/direct
clients ./declare_queues ./direct_producer $py/direct_consumer.py
outputs ./declare_queues.out ./direct_producer.out $py/direct_consumer.py.out
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_cpp_python.in Wed Feb 13 03:44:34 2008
@@ -1,6 +1,6 @@
-==== ./declare_queues.out
-==== ./direct_producer.out
-==== ../../../../python/examples/direct/direct_consumer.py.out
+==== declare_queues.out
+==== direct_producer.out
+==== direct_consumer.py.out
Message 0
Message 1
Message 2
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp Wed Feb 13 03:44:34 2008
@@ -1,5 +1,5 @@
# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=../../../../python/examples/direct
+py=$PYTHON_EXAMPLES/direct
clients $py/declare_queues.py $py/direct_producer.py ./listener
outputs $py/declare_queues.py.out $py/direct_producer.py.out ./listener.out
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/direct/verify_python_cpp.in Wed Feb 13 03:44:34 2008
@@ -1,7 +1,6 @@
-==== ../../../../python/examples/direct/declare_queues.py.out
-==== ../../../../python/examples/direct/direct_producer.py.out
-==== ./listener.out
-Activating listener for: listener_destination
+==== declare_queues.py.out
+==== direct_producer.py.out
+==== listener.out
Message: message 0
Message: message 1
Message: message 2
@@ -13,4 +12,4 @@
Message: message 8
Message: message 9
Message: That's all, folks!
-Shutting down listener for listener_destination
+Shutting down listener for message_queue
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/declare_queues.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/declare_queues.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/declare_queues.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/declare_queues.cpp Wed Feb 13 03:44:34 2008
@@ -20,21 +20,16 @@
*/
/**
- * direct_config_queues.cpp
+ * declare_queues.cpp (this program):
*
* This program is one of three programs designed to be used
- * together. These programs use the "amq.direct" exchange.
+ * together. These programs use the "amq.fanout" 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:
+ * fanout_producer.cpp:
*
* Publishes to a broker, specifying a routing key.
*
- * direct_listener.cpp
+ * listener.cpp
*
* Reads from a queue on the broker using a message listener.
*
@@ -65,9 +60,7 @@
//--------- 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.
-
+ // Create and bind a queue named "message_queue".
session.queueDeclare(arg::queue="message_queue");
session.queueBind(arg::queue="message_queue", arg::exchange="amq.fanout");
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/fanout_producer.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/fanout_producer.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/fanout_producer.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/fanout_producer.cpp Wed Feb 13 03:44:34 2008
@@ -21,22 +21,22 @@
/**
- * direct_publisher.cpp:
+ * 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.
*
- * direct_config_queues.cpp:
+ * declare_queues.cpp:
*
* Creates a queue on a broker, binding a routing key to route
* messages to that queue.
*
- * direct_publisher.cpp (this program):
+ * fanout_producer.cpp (this program):
*
* Publishes to a broker, specifying a routing key.
*
- * direct_listener.cpp
+ * listener.cpp
*
* Reads from a queue on the broker using a message listener.
*
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/listener.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/listener.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/listener.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/listener.cpp Wed Feb 13 03:44:34 2008
@@ -20,32 +20,15 @@
*/
/**
- * direct_listener.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:
- *
- * 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 (this program):
- *
- * Reads from a queue on the broker using a message listener.
- *
+ * listener.cpp: This program reads messages fro a queue on
+ * the broker using a message listener.
*/
#include <qpid/client/Dispatcher.h>
#include <qpid/client/Connection.h>
#include <qpid/client/Session.h>
#include <qpid/client/Message.h>
-#include <qpid/client/MessageListener.h>
+#include <qpid/client/SubscriptionManager.h>
#include <unistd.h>
#include <cstdlib>
@@ -56,43 +39,25 @@
class Listener : public MessageListener{
-private:
- std::string destination_name;
- Dispatcher dispatcher;
-public:
- Listener(Session& session, string destination_name):
- destination_name(destination_name),
- dispatcher(session)
- {};
-
- virtual void listen();
- virtual void received(Message& message);
- ~Listener() { };
+ private:
+ SubscriptionManager& subscriptions;
+ public:
+ Listener(SubscriptionManager& subscriptions);
+ virtual void received(Message& message);
};
-
-void Listener::listen() {
- std::cout << "Activating listener for: " <<destination_name << std::endl;
- dispatcher.listen(destination_name, this);
-
- // ### The following line gives up control - it should be possible
- // ### to listen without giving up control!
-
- dispatcher.run();
-}
-
+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 " <<destination_name << std::endl;
- dispatcher.stop();
+ 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;
@@ -104,24 +69,15 @@
//--------- 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");
+ // Deliver messages until the subscription is cancelled
+ // by Listener::received()
+ subscriptions.run();
- // Subscribe to the queue, route it to a client destination for
- // the listener. (The destination name merely identifies the
- // destination in the listener, you can use any name as long as
- // you use the same name for the listener).
-
- session.messageSubscribe(arg::queue="message_queue", arg::destination="listener_destination");
-
- session.messageFlow(arg::destination="listener_destination", arg::unit=0, arg::value=1);//messages ### Define a constant?
- session.messageFlow(arg::destination="listener_destination", arg::unit=1, arg::value=0xFFFFFFFF);//bytes ###### Define a constant?
-
- // Tell the listener to listen to the destination we just
- // created above.
-
- Listener listener(session, "listener_destination");
- listener.listen();
-
- //-----------------------------------------------------------------------------
+ //---------------------------------------------------------------------------
connection.close();
return 0;
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify.in Wed Feb 13 03:44:34 2008
@@ -1,7 +1,6 @@
-==== ./declare_queues.out
-==== ./fanout_producer.out
-==== ./listener.out
-Activating listener for: listener_destination
+==== declare_queues.out
+==== fanout_producer.out
+==== listener.out
Message: Message 0
Message: Message 1
Message: Message 2
@@ -13,4 +12,4 @@
Message: Message 8
Message: Message 9
Message: That's all, folks!
-Shutting down listener for listener_destination
+Shutting down listener for message_queue
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python Wed Feb 13 03:44:34 2008
@@ -1,5 +1,5 @@
# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=../../../../python/examples/fanout
+py=$PYTHON_EXAMPLES/fanout
clients ./declare_queues ./fanout_producer $py/fanout_consumer.py
outputs ./declare_queues.out ./fanout_producer.out $py/fanout_consumer.py.out
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_cpp_python.in Wed Feb 13 03:44:34 2008
@@ -1,6 +1,6 @@
-==== ./declare_queues.out
-==== ./fanout_producer.out
-==== ../../../../python/examples/fanout/fanout_consumer.py.out
+==== declare_queues.out
+==== fanout_producer.out
+==== fanout_consumer.py.out
Message 0
Message 1
Message 2
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_python_cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_python_cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_python_cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/fanout/verify_python_cpp Wed Feb 13 03:44:34 2008
@@ -1,5 +1,5 @@
# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=../../../../python/examples/fanout
-clients $py/declare_queues.py $py/fanout_producer .py ./listener
+py=$PYTHON_EXAMPLES/fanout
+clients $py/declare_queues.py $py/fanout_producer.py ./listener
outputs $py/declare_queues.py.out $py/fanout_producer.py.out ./listener.out
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify.in Wed Feb 13 03:44:34 2008
@@ -1,4 +1,4 @@
-==== ./topic_publisher.out
+==== topic_publisher.out
==== topic_listener.out | remove_uuid | sort
Declaring queue: europe
Declaring queue: news
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python Wed Feb 13 03:44:34 2008
@@ -1,5 +1,5 @@
# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=../../../../python/examples/pubsub
+py=$PYTHON_EXAMPLES/pubsub
background "Queues created" $py/topic_subscriber.py
clients ./topic_publisher
outputs ./topic_publisher.out "$py/topic_subscriber.py.out | remove_uuid64 | sort"
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_cpp_python.in Wed Feb 13 03:44:34 2008
@@ -1,5 +1,5 @@
-==== ./topic_publisher.out
-==== ../../../../python/examples/pubsub/topic_subscriber.py.out | remove_uuid64 | sort
+==== topic_publisher.out
+==== topic_subscriber.py.out | remove_uuid64 | sort
Message 0
Message 0
Message 0
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp Wed Feb 13 03:44:34 2008
@@ -1,5 +1,5 @@
# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=../../../../python/examples/pubsub
+py=$PYTHON_EXAMPLES/pubsub
background "Listening" ./topic_listener
clients $py/topic_publisher.py
outputs $py/topic_publisher.py.out "topic_listener.out | remove_uuid | sort"
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/pub-sub/verify_python_cpp.in Wed Feb 13 03:44:34 2008
@@ -1,4 +1,4 @@
-==== ../../../../python/examples/pubsub/topic_publisher.py.out
+==== topic_publisher.py.out
==== topic_listener.out | remove_uuid | sort
Declaring queue: europe
Declaring queue: news
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify Wed Feb 13 03:44:34 2008
@@ -2,4 +2,4 @@
background "Waiting" ./server
clients ./client
kill %% # Must kill the server.
-outputs "./client.out | remove_uuid" " server.out | remove_uuid"
+outputs "./client.out | remove_uuid" "server.out | remove_uuid"
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify.in Wed Feb 13 03:44:34 2008
@@ -1,4 +1,4 @@
-==== ./client.out | remove_uuid
+==== client.out | remove_uuid
Activating response queue listener for: client
Request: Twas brillig, and the slithy toves
Request: Did gire and gymble in the wabe.
@@ -10,7 +10,7 @@
Response: ALL MIMSY WERE THE BOROGROVES,
Response: AND THE MOME RATHS OUTGRABE.
Shutting down listener for client
-==== server.out | remove_uuid
+==== server.out | remove_uuid
Activating request queue listener for: request
Waiting for requests
Request: Twas brillig, and the slithy toves (client)
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python Wed Feb 13 03:44:34 2008
@@ -1,6 +1,5 @@
# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=../../../../python/examples/request-response
-background "Request server running" $py/server.py
+background "Request server running" $PYTHON_EXAMPLES/request-response/server.py
clients ./client
kill %% # Must kill the server.
-outputs "./client.out | remove_uuid" "$py/server.py.out | remove_uuid64"
+outputs "./client.out | remove_uuid" "$PYTHON_EXAMPLES/request-response/server.py.out | remove_uuid64"
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_cpp_python.in Wed Feb 13 03:44:34 2008
@@ -1,4 +1,4 @@
-==== ./client.out | remove_uuid
+==== client.out | remove_uuid
Activating response queue listener for: client
Request: Twas brillig, and the slithy toves
Request: Did gire and gymble in the wabe.
@@ -10,6 +10,6 @@
Response: ALL MIMSY WERE THE BOROGROVES,
Response: AND THE MOME RATHS OUTGRABE.
Shutting down listener for client
-==== ../../../../python/examples/request-response/server.py.out | remove_uuid64
+==== server.py.out | remove_uuid64
Request server running - run your client now.
(Times out after 100 seconds ...)
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_python_cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_python_cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_python_cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/examples/examples/request-response/verify_python_cpp Wed Feb 13 03:44:34 2008
@@ -1,6 +1,5 @@
# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify
-py=../../../../python/examples/request-response
-background "Request server running" ./server
-clients $py/client.py
+background "Waiting" ./server
+clients $PYTHON_EXAMPLES/request-response/client.py
kill %% # Must kill the server.
-outputs "./client.py.out | remove_uuid64" " server.out | remove_uuid"
+outputs "$PYTHON_EXAMPLES/request-response/client.py.out | remove_uuid64" "server.out | remove_uuid64"
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/qpidc.spec.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/qpidc.spec.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/qpidc.spec.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/qpidc.spec.in Wed Feb 13 03:44:34 2008
@@ -5,7 +5,7 @@
Name: @PACKAGE@
Version: @VERSION@
-Release: 18%{?dist}
+Release: 22%{?dist}
Summary: Libraries for Qpid C++ client applications
Group: System Environment/Libraries
License: Apache Software License
@@ -73,16 +73,16 @@
%setup -q
%build
-%configure --disable-static --without-cpg CXXFLAGS="-O3 -DNDEBUG"
+%configure --disable-static --without-cpg CXXFLAGS="-g -O3 -DNDEBUG"
make %{?_smp_mflags}
# Remove this generated perl file, we don't need it and it upsets rpmlint.
rm docs/api/html/installdox
%install
rm -rf %{buildroot}
-make install DESTDIR=%{buildroot}
-install -Dp -m0755 etc/qpidd %{buildroot}%{_initrddir}/qpidd
-install -d -m0755 %{buildroot}%{_localstatedir}/qpidd
+make install-strip DESTDIR=%{buildroot}
+install -Dp -m0755 etc/qpidd %{buildroot}%{_initrddir}/qpidd
+install -d -m0755 %{buildroot}%{_localstatedir}/lib/qpidd
rm -f %{buildroot}%_libdir/*.a
rm -f %{buildroot}%_libdir/*.la
@@ -99,7 +99,6 @@
%_libdir/libqpidcommon.so.0.1.0
%_libdir/libqpidclient.so.0
%_libdir/libqpidclient.so.0.1.0
-%_localstatedir/qpidd
%config(noreplace) %_sysconfdir/qpidd.conf
%files devel
@@ -123,6 +122,7 @@
%_libdir/libqpidcluster.so.0.1.0
%_sbindir/%{qpidd}
%{_initrddir}/%{qpidd}
+%_localstatedir/lib/qpidd
%doc %_mandir/man1/%{qpidd}.*
%files -n %{qpidd}-devel
@@ -156,6 +156,14 @@
/sbin/ldconfig
%changelog
+* Tue Feb 12 2008 Alan Conway <ac...@redhat.com> - 0.2-22
+- Added -g to compile flags for debug symbols.
+
+* Tue Feb 12 2008 Alan Conway <ac...@redhat.com> - 0.2-21
+- Create /var/lib/qpidd correctly.
+
+* Mon Feb 11 2008 Rafael Schloming <ra...@redhat.com> - 0.2-20
+- bumped for Beta 3
* Mon Jan 21 2008 Gordon Sim <gs...@redhat.com> - 0.2-18
- bump up rev for recent changes to plugin modules & mgmt
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/DataDir.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/DataDir.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/DataDir.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/DataDir.cpp Wed Feb 13 03:44:34 2008
@@ -20,6 +20,7 @@
#include "Exception.h"
#include "DataDir.h"
+#include "qpid/log/Statement.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -32,7 +33,10 @@
dirPath (path)
{
if (!enabled)
+ {
+ QPID_LOG (info, "No data directory - Disabling persistent configuration");
return;
+ }
const char *cpath = dirPath.c_str ();
struct stat s;
@@ -55,14 +59,20 @@
oss << "Error locking data directory: errno=" << errno;
throw Exception (oss.str ());
}
+
+ QPID_LOG (info, "Locked data directory: " << dirPath);
}
DataDir::~DataDir ()
{
+ if (dirPath.empty ())
+ return;
+
std::string lockFile (dirPath);
lockFile = lockFile + "/lock";
::unlink (lockFile.c_str ());
+ QPID_LOG (info, "Unlocked data directory: " << dirPath);
}
} // namespace qpid
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.cpp Wed Feb 13 03:44:34 2008
@@ -60,6 +60,7 @@
Broker::Options::Options(const std::string& name) :
qpid::Options(name),
+ noDataDir(0),
dataDir("/var/lib/qpidd"),
port(DEFAULT_PORT),
workerThreads(5),
@@ -75,6 +76,8 @@
addOptions()
("data-dir", optValue(dataDir,"DIR"),
"Directory to contain persistent data generated by the broker")
+ ("no-data-dir", optValue(noDataDir),
+ "Don't use a data directory. No persistent configuration will be loaded or stored")
("port,p", optValue(port,"PORT"),
"Tells the broker to listen on PORT")
("worker-threads", optValue(workerThreads, "N"),
@@ -103,7 +106,7 @@
Broker::Broker(const Broker::Options& conf) :
config(conf),
store(0),
- dataDir(conf.dataDir),
+ dataDir(conf.noDataDir ? std::string () : conf.dataDir),
factory(*this),
sessionManager(conf.ack)
{
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.h?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.h (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/Broker.h Wed Feb 13 03:44:34 2008
@@ -61,6 +61,7 @@
struct Options : public qpid::Options {
Options(const std::string& name="Broker Options");
+ bool noDataDir;
std::string dataDir;
uint16_t port;
int workerThreads;
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.cpp Wed Feb 13 03:44:34 2008
@@ -36,9 +36,9 @@
qpid::sys::ConnectionInputHandler*
ConnectionFactory::create(qpid::sys::ConnectionOutputHandler* out,
- const qpid::sys::Socket& s)
+ const std::string& id)
{
- return new Connection(out, broker, s.getPeerAddress());
+ return new Connection(out, broker, id);
}
}} // namespace qpid::broker
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.h?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.h (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/ConnectionFactory.h Wed Feb 13 03:44:34 2008
@@ -32,8 +32,8 @@
public:
ConnectionFactory(Broker& b);
- virtual qpid::sys::ConnectionInputHandler* create
- (qpid::sys::ConnectionOutputHandler* ctxt, const sys::Socket& s);
+ virtual qpid::sys::ConnectionInputHandler*
+ create(qpid::sys::ConnectionOutputHandler* out, const std::string& id);
virtual ~ConnectionFactory();
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/SessionState.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/SessionState.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/SessionState.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/broker/SessionState.cpp Wed Feb 13 03:44:34 2008
@@ -147,12 +147,14 @@
break;
case management::Session::METHOD_CLOSE :
+ /*
if (handler != 0)
{
handler->getConnection().closeChannel(handler->getChannel());
}
status = Manageable::STATUS_OK;
break;
+ */
case management::Session::METHOD_SOLICITACK :
case management::Session::METHOD_RESETLIFESPAN :
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/client/Dispatcher.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/client/Dispatcher.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/client/Dispatcher.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/client/Dispatcher.cpp Wed Feb 13 03:44:34 2008
@@ -75,11 +75,18 @@
if (content->isA<MessageTransferBody>()) {
Message msg(*content, session);
Subscriber::shared_ptr listener = find(msg.getDestination());
- assert(listener);
- listener->received(msg);
+ if (!listener) {
+ QPID_LOG(error, "No listener found for destination " << msg.getDestination());
+ } else {
+ assert(listener);
+ listener->received(msg);
+ }
} else {
- assert (handler.get());
- handler->handle(*content);
+ if (handler.get()) {
+ handler->handle(*content);
+ } else {
+ QPID_LOG(error, "No handler found for " << *(content->getMethod()));
+ }
}
}
} catch (const ClosedException&) {
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/log/Statement.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/log/Statement.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/log/Statement.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/log/Statement.cpp Wed Feb 13 03:44:34 2008
@@ -22,6 +22,7 @@
#include <stdexcept>
#include <algorithm>
#include <syslog.h>
+#include <ctype.h>
namespace qpid {
namespace log {
@@ -29,21 +30,21 @@
namespace {
using namespace std;
-struct IsControl { bool operator()(unsigned char c) { return c < 32; } };
+struct NonPrint { bool operator()(unsigned char c) { return !isprint(c); } };
-bool isClean(const std::string& str) {
- return std::find_if(str.begin(), str.end(), IsControl()) == str.end();
-}
+char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
std::string quote(const std::string& str) {
- IsControl isControl;
- size_t n = std::count_if(str.begin(), str.end(), isControl);
+ NonPrint nonPrint;
+ size_t n = std::count_if(str.begin(), str.end(), nonPrint);
+ if (n==0) return str;
std::string ret;
- ret.reserve(str.size()+n); // Avoid extra allocations.
+ ret.reserve(str.size()+2*n); // Avoid extra allocations.
for (string::const_iterator i = str.begin(); i != str.end(); ++i) {
- if (isControl(*i)) {
- ret.push_back('^');
- ret.push_back((*i)+64);
+ if (nonPrint(*i)) {
+ ret.push_back('\\');
+ ret.push_back(hex[((*i) >> 4)&0xf]);
+ ret.push_back(hex[(*i) & 0xf]);
}
else ret.push_back(*i);
}
@@ -53,7 +54,7 @@
}
void Statement::log(const std::string& message) {
- Logger::instance().log(*this, isClean(message) ? message : quote(message));
+ Logger::instance().log(*this, quote(message));
}
Statement::Initializer::Initializer(Statement& s) : statement(s) {
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/management/ManagementAgent.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/management/ManagementAgent.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/management/ManagementAgent.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/management/ManagementAgent.cpp Wed Feb 13 03:44:34 2008
@@ -74,16 +74,16 @@
}
void ManagementAgent::addObject (ManagementObject::shared_ptr object,
- uint64_t persistenceId,
- uint64_t idOffset)
+ uint64_t /*persistenceId*/,
+ uint64_t /*idOffset*/)
{
RWlock::ScopedWlock writeLock (userLock);
uint64_t objectId;
- if (persistenceId == 0)
+// if (persistenceId == 0)
objectId = nextObjectId++;
- else
- objectId = 0x8000000000000000ULL | (persistenceId + idOffset);
+// else
+// objectId = 0x8000000000000000ULL | (persistenceId + idOffset);
object->setObjectId (objectId);
managementObjects[objectId] = object;
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/AsynchIOAcceptor.cpp Wed Feb 13 03:44:34 2008
@@ -140,7 +140,7 @@
void AsynchIOAcceptor::accepted(Poller::shared_ptr poller, const Socket& s, ConnectionInputHandlerFactory* f) {
AsynchIOHandler* async = new AsynchIOHandler;
- ConnectionInputHandler* handler = f->create(async, s);
+ ConnectionInputHandler* handler = f->create(async, s.getPeerAddress());
AsynchIO* aio = new AsynchIO(s,
boost::bind(&AsynchIOHandler::readbuff, async, _1, _2),
boost::bind(&AsynchIOHandler::eof, async, _1),
@@ -194,7 +194,7 @@
socket->connect(host, port);
AsynchIOHandler* async = new AsynchIOHandler;
async->setClient();
- ConnectionInputHandler* handler = f->create(async, *socket);
+ ConnectionInputHandler* handler = f->create(async, socket->getPeerAddress());
AsynchIO* aio = new AsynchIO(*socket,
boost::bind(&AsynchIOHandler::readbuff, async, _1, _2),
boost::bind(&AsynchIOHandler::eof, async, _1),
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpid/sys/ConnectionInputHandlerFactory.h Wed Feb 13 03:44:34 2008
@@ -22,7 +22,7 @@
#define _ConnectionInputHandlerFactory_
#include <boost/noncopyable.hpp>
-#include "qpid/sys/Socket.h"
+#include <string>
namespace qpid {
namespace sys {
@@ -37,7 +37,13 @@
class ConnectionInputHandlerFactory : private boost::noncopyable
{
public:
- virtual ConnectionInputHandler* create(ConnectionOutputHandler* ctxt, const Socket& s) = 0;
+ /**
+ *@param out handler for connection output.
+ *@param id identify the connection for management purposes.
+ */
+ virtual ConnectionInputHandler* create(ConnectionOutputHandler* out,
+ const std::string& id) = 0;
+
virtual ~ConnectionInputHandlerFactory(){}
};
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpidd.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpidd.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpidd.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/qpidd.cpp Wed Feb 13 03:44:34 2008
@@ -48,9 +48,9 @@
ModuleOptions() : qpid::Options("Module options"), loadDir("/usr/lib/qpidd"), noLoad(false)
{
addOptions()
- ("load-dir", optValue(loadDir, "DIR"), "Load all modules from this directory")
- ("load-module", optValue(load, "FILE"), "Specifies additional module(s) to be loaded")
- ("no-modules", optValue(noLoad), "Don't load any modules");
+ ("module-dir", optValue(loadDir, "DIR"), "Load all .so modules in this directory")
+ ("load-module", optValue(load, "FILE"), "Specifies additional module(s) to be loaded")
+ ("no-module-dir", optValue(noLoad), "Don't load modules from module directory");
}
};
@@ -122,7 +122,7 @@
void shutdownHandler(int /*signal*/){
// Note: do not call any async-signal unsafe functions here.
- // Do any extra shtudown actions in main() after broker->run()
+ // Do any extra shutdown actions in main() after broker->run()
brokerPtr->shutdown();
}
@@ -140,6 +140,7 @@
uint16_t port=brokerPtr->getPort();
ready(port); // Notify parent.
brokerPtr->run();
+ brokerPtr.reset();
}
};
@@ -188,12 +189,13 @@
// be re-parsed with all of the module-supplied options.
bootOptions.parse (argc, argv, bootOptions.common.config, true);
qpid::log::Logger::instance().configure(bootOptions.log, argv[0]);
- if (!bootOptions.module.noLoad) {
- for (vector<string>::iterator iter = bootOptions.module.load.begin();
- iter != bootOptions.module.load.end();
- iter++)
- tryShlib (iter->data(), false);
+ for (vector<string>::iterator iter = bootOptions.module.load.begin();
+ iter != bootOptions.module.load.end();
+ iter++)
+ tryShlib (iter->data(), false);
+
+ if (!bootOptions.module.noLoad) {
bool isDefault = defaultPath == bootOptions.module.loadDir;
loadModuleDir (bootOptions.module.loadDir, isDefault);
}
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/ClientSessionTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/ClientSessionTest.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/ClientSessionTest.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/ClientSessionTest.cpp Wed Feb 13 03:44:34 2008
@@ -21,6 +21,7 @@
#include "unit_test.h"
#include "BrokerFixture.h"
#include "qpid/client/Dispatcher.h"
+#include "qpid/sys/Monitor.h"
#include "qpid/sys/Thread.h"
#include "qpid/sys/Runnable.h"
#include "qpid/client/Session_0_10.h"
@@ -38,6 +39,7 @@
using namespace qpid::client::arg;
using namespace qpid::framing;
using namespace qpid;
+using qpid::sys::Monitor;
using std::string;
using std::cout;
using std::endl;
@@ -67,6 +69,27 @@
}
};
+struct SimpleListener : public MessageListener
+{
+ Monitor lock;
+ std::vector<Message> messages;
+
+ void received(Message& msg)
+ {
+ Monitor::ScopedLock l(lock);
+ messages.push_back(msg);
+ lock.notifyAll();
+ }
+
+ void waitFor(const uint n)
+ {
+ Monitor::ScopedLock l(lock);
+ while (messages.size() < n) {
+ lock.wait();
+ }
+ }
+};
+
struct ClientSessionFixture : public ProxySessionFixture
{
void declareSubscribe(const string& q="my-queue",
@@ -167,22 +190,31 @@
BOOST_CHECK_EQUAL(string("my-message"), msg->getContent());
}
+/**
+ * Currently broken due to a deadlock in SessionCore
+ *
BOOST_FIXTURE_TEST_CASE(testSendToSelf, SessionFixture) {
- // https://bugzilla.redhat.com/show_bug.cgi?id=410551
// Deadlock if SubscriptionManager run() concurrent with session ack.
- LocalQueue myq;
+ SimpleListener mylistener;
session.queueDeclare(queue="myq", exclusive=true, autoDelete=true);
- subs.subscribe(myq, "myq");
+ subs.subscribe(mylistener, "myq", "myq");
+ sys::Thread runner(subs);//start dispatcher thread
string data("msg");
Message msg(data, "myq");
- const int count=100; // Verified with count=100000 in a loop.
- for (int i = 0; i < count; ++i)
+ const uint count=10000;
+ for (uint i = 0; i < count; ++i) {
session.messageTransfer(content=msg);
- for (int j = 0; j < count; ++j) {
- Message m=myq.pop();
- BOOST_CHECK_EQUAL(m.getData(), data);
+ }
+ mylistener.waitFor(count);
+ subs.cancel("myq");
+ subs.stop();
+ session.close();
+ BOOST_CHECK_EQUAL(mylistener.messages.size(), count);
+ for (uint j = 0; j < count; ++j) {
+ BOOST_CHECK_EQUAL(mylistener.messages[j].getData(), data);
}
}
+*/
QPID_AUTO_TEST_SUITE_END()
Modified: incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/logging.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/logging.cpp?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/logging.cpp (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/cpp/src/tests/logging.cpp Wed Feb 13 03:44:34 2008
@@ -367,7 +367,7 @@
unlink("logging.tmp");
}
-BOOST_AUTO_TEST_CASE(testQuoteControlChars) {
+BOOST_AUTO_TEST_CASE(testQuoteNonPrintable) {
Logger& l=Logger::instance();
l.clear();
Options opts;
@@ -375,13 +375,13 @@
opts.outputs.push_back("logging.tmp");
opts.time=false;
l.configure(opts, "test");
- char s[] = "null\0tab\tspace newline\nret\r";
+ char s[] = "null\0tab\tspace newline\nret\r\x80\x99\xff";
string str(s, sizeof(s));
QPID_LOG(critical, str);
ifstream log("logging.tmp");
string line;
getline(log, line);
- string expect="critical null^@tab^Ispace newline^Jret^M^@";
+ string expect="critical null\\00tab\\09space newline\\0Aret\\0D\\80\\99\\FF\\00";
BOOST_CHECK_EQUAL(expect, line);
log.close();
unlink("logging.tmp");
Modified: incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java Wed Feb 13 03:44:34 2008
@@ -231,6 +231,14 @@
sb.append('?');
+ if (_routingKey != null)
+ {
+ sb.append(BindingURL.OPTION_ROUTING_KEY);
+ sb.append("='");
+ sb.append(_routingKey).append("'");
+ sb.append(URLHelper.DEFAULT_OPTION_SEPERATOR);
+ }
+
if (_isDurable)
{
sb.append(BindingURL.OPTION_DURABLE);
Modified: incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java Wed Feb 13 03:44:34 2008
@@ -16,6 +16,7 @@
import org.apache.qpidity.transport.Channel;
import org.apache.qpidity.transport.Connection;
import org.apache.qpidity.transport.ConnectionClose;
+import org.apache.qpidity.transport.ConnectionCloseOk;
import org.apache.qpidity.transport.ConnectionDelegate;
import org.apache.qpidity.transport.ConnectionEvent;
import org.apache.qpidity.transport.ProtocolHeader;
@@ -33,6 +34,9 @@
private ClosedListener _closedListner;
private final Lock _lock = new ReentrantLock();
private static Logger _logger = LoggerFactory.getLogger(Client.class);
+ private Condition closeOk;
+ private boolean closed = false;
+
/**
*
* @return returns a new connection to the broker.
@@ -45,6 +49,7 @@
public void connect(String host, int port,String virtualHost,String username, String password) throws QpidException
{
Condition negotiationComplete = _lock.newCondition();
+ closeOk = _lock.newCondition();
_lock.lock();
ConnectionDelegate connectionDelegate = new ConnectionDelegate()
@@ -76,6 +81,21 @@
}
}
+ @Override public void connectionCloseOk(Channel context, ConnectionCloseOk struct)
+ {
+ _lock.lock();
+ try
+ {
+ closed = true;
+ this.receivedClose = true;
+ closeOk.signalAll();
+ }
+ finally
+ {
+ _lock.unlock();
+ }
+ }
+
@Override public void connectionClose(Channel context, ConnectionClose connectionClose)
{
ErrorCode errorCode = ErrorCode.get(connectionClose.getReplyCode());
@@ -179,6 +199,24 @@
{
Channel ch = _conn.getChannel(0);
ch.connectionClose(0, "client is closing", 0, 0);
+ _lock.lock();
+ try
+ {
+ try {
+ while (!closed)
+ {
+ closeOk.await();
+ }
+ }
+ catch (InterruptedException e)
+ {
+ // do nothing
+ }
+ }
+ finally
+ {
+ _lock.unlock();
+ }
_conn.close();
}
Modified: incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java Wed Feb 13 03:44:34 2008
@@ -59,16 +59,27 @@
private InitialContext _initialContext;
private AMQConnectionFactory _connectionFactory;
- protected void setUp() throws Exception
+ public void runBare() throws Throwable
{
- super.setUp();
+ String name = getClass().getSimpleName() + "." + getName();
+ _logger.info("========== start " + name + " ==========");
startBroker();
- }
-
- protected void tearDown() throws Exception
- {
- stopBroker();
- super.tearDown();
+ try
+ {
+ super.runBare();
+ }
+ finally
+ {
+ try
+ {
+ stopBroker();
+ }
+ catch (Exception e)
+ {
+ _logger.error("exception stopping broker", e);
+ }
+ _logger.info("========== stop " + name + " ==========");
+ }
}
public void startBroker() throws Exception
@@ -102,7 +113,8 @@
}
catch (IOException e)
{
- _logger.info("redirector", e);
+ // this seems to happen regularly even when
+ // exits are normal
}
}
}.start();
@@ -188,6 +200,11 @@
_connectionFactory = (AMQConnectionFactory) getInitialContext().lookup("local");
}
return _connectionFactory;
+ }
+
+ public Connection getConnection() throws Exception
+ {
+ return getConnection("guest", "guest");
}
/**
Modified: incubator/qpid/branches/thegreatmerge/qpid/java/common.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/common.xml?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/java/common.xml (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/java/common.xml Wed Feb 13 03:44:34 2008
@@ -198,6 +198,13 @@
that modules build root from underneath the project build root:
${build}/<module>
+
+ ant clean-results
+
+ The clean-results target removes all test output from the test
+ results directory:
+
+ ${build.results}
</echo>
</target>
Modified: incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java Wed Feb 13 03:44:34 2008
@@ -63,6 +63,7 @@
private long commandsIn = 0;
// completed incoming commands
private final RangeSet processed = new RangeSet();
+ private long processedMark = -1;
private Range syncPoint = null;
// outgoing command count
@@ -132,25 +133,25 @@
public void flushProcessed()
{
- long mark = -1;
boolean first = true;
RangeSet rest = new RangeSet();
synchronized (processed)
{
for (Range r: processed)
{
- if (first)
+ if (first && r.includes(processedMark))
{
- first = false;
- mark = r.getUpper();
+ processedMark = r.getUpper();
}
else
{
rest.add(r);
}
+
+ first = false;
}
}
- executionComplete(mark, rest);
+ executionComplete(processedMark, rest);
}
void syncPoint()
Modified: incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/java/common/src/main/java/org/apache/qpidity/transport/network/mina/MinaSender.java Wed Feb 13 03:44:34 2008
@@ -51,16 +51,23 @@
{
throw new TransportException("attempted to write to a closed socket");
}
- lastWrite = session.write(ByteBuffer.wrap(buf));
+
+ synchronized (this)
+ {
+ lastWrite = session.write(ByteBuffer.wrap(buf));
+ }
}
- public void close()
+ public synchronized void close()
{
// MINA will sometimes throw away in-progress writes when you
// ask it to close
- if (lastWrite != null)
+ synchronized (this)
{
- lastWrite.join();
+ if (lastWrite != null)
+ {
+ lastWrite.join();
+ }
}
CloseFuture closed = session.close();
closed.join();
Modified: incubator/qpid/branches/thegreatmerge/qpid/java/module.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/module.xml?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/java/module.xml (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/java/module.xml Wed Feb 13 03:44:34 2008
@@ -176,7 +176,7 @@
<target name="test" depends="compile-tests" if="module.test.src.exists"
description="execute unit tests">
- <junit fork="yes" haltonfailure="no" printsummary="on" timeout="90000">
+ <junit fork="yes" haltonfailure="no" printsummary="on" timeout="600000">
<sysproperty key="amqj.logging.level" value="${amqj.logging.level}"/>
<sysproperty key="root.logging.level" value="${root.logging.level}"/>
Modified: incubator/qpid/branches/thegreatmerge/qpid/python/examples/direct/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/python/examples/direct/verify.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/python/examples/direct/verify.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/python/examples/direct/verify.in Wed Feb 13 03:44:34 2008
@@ -1,6 +1,6 @@
-==== ./declare_queues.py.out
-==== ./direct_producer.py.out
-==== ./direct_consumer.py.out
+==== declare_queues.py.out
+==== direct_producer.py.out
+==== direct_consumer.py.out
message 0
message 1
message 2
Modified: incubator/qpid/branches/thegreatmerge/qpid/python/examples/fanout/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/python/examples/fanout/verify.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/python/examples/fanout/verify.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/python/examples/fanout/verify.in Wed Feb 13 03:44:34 2008
@@ -1,6 +1,6 @@
-==== ./declare_queues.py.out
-==== ./fanout_producer.py.out
-==== ./fanout_consumer.py.out
+==== declare_queues.py.out
+==== fanout_producer.py.out
+==== fanout_consumer.py.out
message 0
message 1
message 2
Modified: incubator/qpid/branches/thegreatmerge/qpid/python/examples/pubsub/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/python/examples/pubsub/verify.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/python/examples/pubsub/verify.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/python/examples/pubsub/verify.in Wed Feb 13 03:44:34 2008
@@ -1,4 +1,4 @@
-==== ./topic_publisher.py.out
+==== topic_publisher.py.out
==== topic_subscriber.py.out | remove_uuid64 | sort
message 0
message 0
Modified: incubator/qpid/branches/thegreatmerge/qpid/python/examples/request-response/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/python/examples/request-response/verify.in?rev=627359&r1=627358&r2=627359&view=diff
==============================================================================
--- incubator/qpid/branches/thegreatmerge/qpid/python/examples/request-response/verify.in (original)
+++ incubator/qpid/branches/thegreatmerge/qpid/python/examples/request-response/verify.in Wed Feb 13 03:44:34 2008
@@ -1,4 +1,4 @@
-==== ./client.py.out | remove_uuid64
+==== client.py.out | remove_uuid64
Request: Twas brilling, and the slithy toves
Request: Did gyre and gimble in the wabe.
Request: All mimsy were the borogroves,
@@ -9,6 +9,6 @@
Response: ALL MIMSY WERE THE BOROGROVES,
Response: AND THE MOME RATHS OUTGRABE.
No more messages!
-==== server.py.out | remove_uuid64
+==== server.py.out | remove_uuid64
Request server running - run your client now.
(Times out after 100 seconds ...)