summaryrefslogtreecommitdiff
path: root/qpid/java/client
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/client')
-rw-r--r--qpid/java/client/README.txt51
-rw-r--r--qpid/java/client/build.xml20
-rw-r--r--qpid/java/client/example/bin/README.txt11
-rw-r--r--qpid/java/client/example/bin/set_classpath.bat49
-rwxr-xr-xqpid/java/client/example/bin/set_classpath.sh82
-rw-r--r--qpid/java/client/example/source-jar.xml35
-rw-r--r--qpid/java/client/example/src/main/java/README.txt264
-rwxr-xr-xqpid/java/client/src/main/java/client.bnd29
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java20
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java8
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java4
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java20
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java6
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java20
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java40
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java1
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java3
17 files changed, 201 insertions, 462 deletions
diff --git a/qpid/java/client/README.txt b/qpid/java/client/README.txt
new file mode 100644
index 0000000000..57a98cc978
--- /dev/null
+++ b/qpid/java/client/README.txt
@@ -0,0 +1,51 @@
+Documentation
+=============
+
+You can access documentation for the client via our website at:
+http://qpid.apache.org/documentation
+
+and via our wiki at:
+http://cwiki.apache.org/confluence/display/qpid/Qpid+Java+Documentation
+
+The client uses the Java Message Service (JMS) 1.1 API, information on which is
+widely available using your favoured search engine.
+
+
+Running the Examples:
+=====================
+
+1. From the client Binary distribution:
+
+From the <installation path>/qpid-client-<version> directory, there are examples
+provided in source form in the example/src sub-directory. These are also
+provided in binary form in the example/lib directory in order that they can be
+run more easily.
+
+E.g, in order to run the Hello example, you would add the client+example library
+files to the java classpath and launch the example like follows:
+
+java -cp "lib/qpid-all.jar:example/lib/qpid-client-examples-<version>.jar" \
+ org.apache.qpid.example.Hello
+
+NOTE: The client uses the SL4FJ API for its logging. You must supply a logging
+implementation of your choice (eg Log4J) and its associated SLF4J binding, by
+also adding them to the Java classpath as well as the client libraries
+themselves. Failure to do so will result in a warning being output and use of
+NoOp logging by the client.
+
+More information on using SLF4J is available at http://www.slf4j.org/manual.html
+which details some of the supported logging implementations and their
+associated SLF4 bindings as available in the SLF4J distribution.
+
+
+
+2. From the Source distribution / repository:
+
+Run 'ant build' in the parent directory from where this file is stored, ie:
+<installation path>/qpid/java
+
+This will build the various Java modules, leaving binary .jar files output in:
+<installation path>/qpid/java/build/lib
+
+Taking the above the 'distribution directory', consult the README.txt file at:
+<installation path>/qpid/java/client/example/src/main/java
diff --git a/qpid/java/client/build.xml b/qpid/java/client/build.xml
index 3c6132dc5b..d52de8dca6 100644
--- a/qpid/java/client/build.xml
+++ b/qpid/java/client/build.xml
@@ -27,6 +27,9 @@
<import file="../module.xml"/>
+ <property name="example.src.dir" value="${project.root}/client/example/src/main/java" />
+ <property name="example.jar.file" value="${build.lib}/qpid-client-example-${project.version}.jar" />
+
<property name="output.dir" value="${module.precompiled}/org/apache/qpid/filter/selector"/>
<target name="precompile">
@@ -46,6 +49,23 @@
classpathref="module.class.path" packagenames="org.apache.qpid.jms"/>
</target>
+ <target name="release-bin-copy-examples">
+ <copy todir="${module.release}/example/src" failonerror="true">
+ <fileset dir="${example.src.dir}" excludes="runSample.sh README.txt" />
+ </copy>
+ <copy todir="${module.release}/example/lib" failonerror="true">
+ <fileset file="${example.jar.file}"/>
+ </copy>
+ </target>
+
+ <target name="release-bin-copy-readme">
+ <copy todir="${module.release}" overwrite="true" failonerror="true">
+ <fileset file="${basedir}/README.txt" />
+ </copy>
+ </target>
+
+ <target name="release-bin-other" depends="release-bin-copy-examples,release-bin-copy-readme"/>
+
<target name="release-bin" depends="release-bin-tasks"/>
<target name="bundle" depends="bundle-tasks"/>
diff --git a/qpid/java/client/example/bin/README.txt b/qpid/java/client/example/bin/README.txt
deleted file mode 100644
index 9a1ce91d41..0000000000
--- a/qpid/java/client/example/bin/README.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-= Qpid Java Examples =
-
-For more information read ../README.txt.
-
-== The Verify All Script ==
-
-The verify_all script will run Java examples against itself and against the C++
-and Python examples. The success of the script is determined by comparing its
-output against what is expected.
-
-This script uses the verify script found in qpid/cpp/examples.
diff --git a/qpid/java/client/example/bin/set_classpath.bat b/qpid/java/client/example/bin/set_classpath.bat
deleted file mode 100644
index 862e8e467a..0000000000
--- a/qpid/java/client/example/bin/set_classpath.bat
+++ /dev/null
@@ -1,49 +0,0 @@
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-
-@REM Helper script to set classpath for running Qpid example classes
-@REM NB: You must add the Qpid client and common jars to your CLASSPATH
-@REM before running this script
-
-@echo off
-
-if "%QPID_HOME%" == "" GOTO ERROR_QPID_HOME
-
-set QPIDLIB=%QPID_HOME%\lib
-
-if "%CLASSPATH%" == "" GOTO ERROR_CLASSPATH
-
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\geronimo-jms_1.1_spec-1.0.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\commons-collections-3.1.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\commons-configuration-1.2.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\commons-cli-1.0.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\commons-lang-2.1.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\commons-logging-api-1.0.4.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\commons-logging-1.0.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\log4j-1.2.12.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\mina-core-1.1.7.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\mina-filter-ssl-1.1.7.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\mina-java5-1.0.0.jar
-set CLASSPATH=%CLASSPATH%;%QPIDLIB%\slf4j-simple-1.0.jar
-
-GOTO END
-
-:ERROR_CLASSPATH
-Echo Please set set your CLASSPATH variable to include the Qpid client and common jars. Exiting ....
-:ERROR_QPID_HOME
-Echo Please set QPID_HOME variable. Exiting ....
-:END
diff --git a/qpid/java/client/example/bin/set_classpath.sh b/qpid/java/client/example/bin/set_classpath.sh
deleted file mode 100755
index a4f1b93625..0000000000
--- a/qpid/java/client/example/bin/set_classpath.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh -xv
-#
-# 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.
-#
-
-# Helper script to set classpath for running Qpid example classes
-# NB: You must add the Qpid client and common jars to your CLASSPATH
-# before running this script
-
-
-cygwin=false
-if [[ "$(uname -a | fgrep Cygwin)" != "" ]]; then
- cygwin=true
-fi
-
-#Should have set the QPID_HOME var after install to the working dir e.g. home/qpid/qpid-1.0-incubating-M2-SNAPSHOT
-if [ "$QPID_HOME" = "" ] ; then
- echo "ERROR: Please set QPID_HOME variable. Exiting ...."
- exit 1
-else
- QPIDLIB=$QPID_HOME/lib
-fi
-
-if $cygwin; then
- QPIDLIB=$(cygpath -w $QPIDLIB)
-fi
-
-if [ "$CLASSPATH" = "" ] ; then
- echo "ERROR: Please set set your CLASSPATH variable to include the Qpid client and common jars. Exiting ...."
- exit 2
-fi
-
-#Converts paths for cygwin if req
-#Some nasty concatenation to get round cygpath line limits
-if $cygwin; then
- SEP=";"
- CLASSPATH=`cygpath -w $CLASSPATH`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/geronimo-jms_1.1_spec-1.0.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/commons-collections-3.1.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/commons-configuration-1.2.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/commons-cli-1.0.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/commons-lang-2.1.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/commons-logging-api-1.0.4.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/commons-logging-1.0.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/log4j-1.2.12.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/mina-core-1.1.7.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/mina-filter-ssl-1.1.7.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/mina-java5-1.0.0.jar`
- CLASSPATH=$CLASSPATH$SEP`cygpath -w $QPIDLIB/slf4j-simple-1.0.jar`
- export CLASSPATH
-else
- CLASSPATH=$CLASSPATH:$QPIDLIB/backport-util-concurrent-2.2.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/geronimo-jms_1.1_spec-1.0.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/commons-collections-3.1.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/commons-configuration-1.2.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/commons-cli-1.0.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/commons-lang-2.1.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/commons-logging-api-1.0.4.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/commons-logging-1.0.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/log4j-1.2.12.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/mina-core-1.0.0.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/mina-filter-ssl-1.0.0.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/mina-java5-1.0.0.jar
- CLASSPATH=$CLASSPATH:$QPIDLIB/slf4j-simple-1.0.jar
- export CLASSPATH
-fi
-
diff --git a/qpid/java/client/example/source-jar.xml b/qpid/java/client/example/source-jar.xml
deleted file mode 100644
index 60451448b8..0000000000
--- a/qpid/java/client/example/source-jar.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<!-- This is an assembly descriptor that produces a jar file that contains all the
- dependencies, fully expanded into a single jar, required to run the tests of
- a maven project.
- -->
-<assembly>
- <id>source</id>
- <formats>
- <format>jar</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>src/main/java</directory>
- <outputDirectory></outputDirectory>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/qpid/java/client/example/src/main/java/README.txt b/qpid/java/client/example/src/main/java/README.txt
index 7b371f17b5..757054e492 100644
--- a/qpid/java/client/example/src/main/java/README.txt
+++ b/qpid/java/client/example/src/main/java/README.txt
@@ -23,267 +23,11 @@ Note: you must have write privileges to this directory in order to run
the examples.
-Running the Direct Examples
+Running the Examples
===========================
To run these programs, do the following:
- 1. Make sure that a qpidd broker is running:
-
- $ ps -eaf | grep qpidd
-
- If a broker is running, you should see the qpidd process in the
- output of the above command.
-
- 2. In the java directory, use runSample.sh to run the Consumer
- program:
-
- $ ./runSample.sh org.apache.qpid.example.jmsexample.direct.Consumer
- Using QPID_HOME: /usr/share/java/
- Using QPID_SAMPLE: /usr/share/doc/rhm-0.3
- Consumer: Setting an ExceptionListener on the connection as sample uses a MessageConsumer
- Consumer: Creating a non-transacted, auto-acknowledged session
- Consumer: Creating a MessageConsumer
- Consumer: Starting connection so MessageConsumer can receive messages
-
- 3. In a separate window, use runSample.sh to run the Producer
- program:
-
- $ ./runSample.sh org.apache.qpid.example.jmsexample.direct.Producer
- Using QPID_HOME: /usr/share/java/
- Using QPID_SAMPLE: /usr/share/doc/rhm-0.3
- Producer: Creating a non-transacted, auto-acknowledged session
- Producer: Creating a Message Producer
- Producer: Creating a TestMessage to send to the destination
- Producer: Sending message: 1
- Producer: Sending message: 2
- Producer: Sending message: 3
- Producer: Sending message: 4
- Producer: Sending message: 5
- Producer: Sending message: 6
- Producer: Sending message: 7
- Producer: Sending message: 8
- Producer: Sending message: 9
- Producer: Sending message: 10
- Producer: Closing connection
- Producer: Closing JNDI context
-
- 4. Now go back to the window where the Consumer program is
- running. You should see the following output:
-
- Consumer: Received message: Message 1
- Consumer: Received message: Message 2
- Consumer: Received message: Message 3
- Consumer: Received message: Message 4
- Consumer: Received message: Message 5
- Consumer: Received message: Message 6
- Consumer: Received message: Message 7
- Consumer: Received message: Message 8
- Consumer: Received message: Message 9
- Consumer: Received message: Message 10
- Consumer: Received final message That's all, folks!
- Consumer: Closing connection
- Consumer: Closing JNDI context
-
-
-
-Running the Fanout Examples
-===========================
-
-To run these programs, do the following:
-
- 1. Make sure that a qpidd broker is running:
-
- $ ps -eaf | grep qpidd
-
- If a broker is running, you should see the qpidd process in the
- output of the above command.
-
- 2. In the java directory, use runSample.sh to run the Consumer or
- Listener program, specifying a unique queue name, which must be
- “fanoutQueue1”, “fanoutQueue2”, or “fanoutQueue3”:
-
- $ ./runSample.sh org.apache.qpid.example.jmsexample.fanout.Consumer fanoutQueue1
- Using QPID_HOME: /usr/share/java/
- Using QPID_SAMPLE: /usr/share/doc/rhm-0.3
- Consumer: Setting an ExceptionListener on the connection as sample uses a MessageConsumer
- Consumer: Creating a non-transacted, auto-acknowledged session
- Consumer: Creating a MessageConsumer
- Consumer: Starting connection so MessageConsumer can receive messages
-
- You can do this in up to three windows, specifying a different
- name for each queue.
-
- 3. In a separate window, use runSample.sh to run the Producer
- program:
-
- $ ./runSample.sh org.apache.qpid.example.jmsexample.fanout.Producer
- Using QPID_HOME: /usr/share/java/
- Using QPID_SAMPLE: /usr/share/doc/rhm-0.3
- Producer: Creating a non-transacted, auto-acknowledged session
- Producer: Creating a Message Producer
- Producer: Creating a TestMessage to send to the destination
- Producer: Sending message: 1
- Producer: Sending message: 2
- Producer: Sending message: 3
- Producer: Sending message: 4
- Producer: Sending message: 5
- Producer: Sending message: 6
- Producer: Sending message: 7
- Producer: Sending message: 8
- Producer: Sending message: 9
- Producer: Sending message: 10
- Producer: Closing connection
- Producer: Closing JNDI context
-
- 4. Now go back to the window where the Listener program is
- running. You should see output like this:
-
- Consumer: Received message: Message 1
- Consumer: Received message: Message 2
- Consumer: Received message: Message 3
- Consumer: Received message: Message 4
- Consumer: Received message: Message 5
- Consumer: Received message: Message 6
- Consumer: Received message: Message 7
- Consumer: Received message: Message 8
- Consumer: Received message: Message 9
- Consumer: Received message: Message 10
- Consumer: Received final message That's all, folks!
- Consumer: Closing connection
- Consumer: Closing JNDI context
-
-
-Running the Publish/Subscribe Examples
-======================================
-
-To run these programs, do the following:
-
- 1. Make sure that a qpidd broker is running:
-
- $ ps -eaf | grep qpidd
-
- If a broker is running, you should see the qpidd process in the
- output of the above command.
-
- 2. In the java directory, use runSample.sh to run the Listener
- program:
-
- $ ./runSample.sh org.apache.qpid.example.jmsexample.pubsub.Listener
- Using QPID_HOME: /usr/share/java/
- Using QPID_SAMPLE: /usr/share/doc/rhm-0.3
- Listener: Setting an ExceptionListener on the connection as sample uses a TopicSubscriber
- Listener: Creating a non-transacted, auto-acknowledged session
- Listener: Creating a Message Subscriber for topic usa
- Listener: Creating a Message Subscriber for topic europe
- Listener: Creating a Message Subscriber for topic news
- Listener: Creating a Message Subscriber for topic weather
- Listener: Starting connection so TopicSubscriber can receive messages
-
- 3. In a separate window, use runSample.sh to run the Publisher
- program:
-
- $ ./runSample.sh org.apache.qpid.example.jmsexample.pubsub.Publisher
- Using QPID_HOME: /usr/share/java/
- Using QPID_SAMPLE: /usr/share/doc/rhm-0.3
- Publisher: Creating a non-transacted, auto-acknowledged session
- Publisher: Creating a TestMessage to send to the topics
- Publisher: Creating a Message Publisher for topic usa.weather
- Publisher: Sending message 1
- Publisher: Sending message 2
- Publisher: Sending message 3
- Publisher: Sending message 4
- Publisher: Sending message 5
- Publisher: Sending message 6
- Publisher: Creating a Message Publisher for topic usa.news
- Publisher: Sending message 1
- Publisher: Sending message 2
- Publisher: Sending message 3
- Publisher: Sending message 4
- Publisher: Sending message 5
- Publisher: Sending message 6
- Publisher: Creating a Message Publisher for topic europe.weather
- Publisher: Sending message 1
- Publisher: Sending message 2
- Publisher: Sending message 3
- Publisher: Sending message 4
- Publisher: Sending message 5
- Publisher: Sending message 6
- Publisher: Creating a Message Publisher for topic europe.news
- Publisher: Sending message 1
- Publisher: Sending message 2
- Publisher: Sending message 3
- Publisher: Sending message 4
- Publisher: Sending message 5
- Publisher: Sending message 6
- Publisher: Closing connection
- Publisher: Closing JNDI context
-
- 4. Now go back to the window where the Listener program is
- running. You should see output like this:
-
- Listener: Received message for topic: usa: message 1
- Listener: Received message for topic: weather: message 1
- Listener: Received message for topic: usa: message 2
- Listener: Received message for topic: weather: message 2
- Listener: Received message for topic: usa: message 3
- Listener: Received message for topic: weather: message 3
- Listener: Received message for topic: usa: message 4
- Listener: Received message for topic: weather: message 4
- Listener: Received message for topic: usa: message 5
- Listener: Received message for topic: weather: message 5
- Listener: Received message for topic: usa: message 6
- Listener: Received message for topic: weather: message 6
- . . .
- Listener: Shutting down listener for news
- Listener: Shutting down listener for weather
- Listener: Shutting down listener for usa
- Listener: Shutting down listener for europe
- Listener: Closing connection
- Listener: Closing JNDI context
-
-
-Running the Request/Response Examples
-=====================================
-
-To run these programs, do the following:
-
- 1. Make sure that a qpidd broker is running:
-
- $ ps -eaf | grep qpidd
-
- If a broker is running, you should see the qpidd process in the output of the above command.
-
- 2. In the java directory, use runSample.sh to run the Server
- program:
-
- $ ./runSample.sh org.apache.qpid.example.jmsexample.requestResponse.Server
- Using QPID_HOME: /usr/share/java/
- Using QPID_SAMPLE: /usr/share/doc/rhm-0.3
- Server: Setting an ExceptionListener on the connection as sample uses a MessageConsumer
- Server: Creating a non-transacted, auto-acknowledged session
- Server: Creating a MessageConsumer
- Server: Creating a MessageProducer
- Server: Starting connection so MessageConsumer can receive messages
-
- 3. In a separate window, use runSample.sh to run the Client
- program:
-
- $ ./runSample.sh org.apache.qpid.example.jmsexample.requestResponse.Client
- Using QPID_HOME: /usr/share/java/
- Using QPID_SAMPLE: /usr/share/doc/rhm-0.3
- Client: Setting an ExceptionListener on the connection as sample uses a MessageConsumer
- Client: Creating a non-transacted, auto-acknowledged session
- Client: Creating a QueueRequestor
- Client: Starting connection
- Client: Request Content= Twas brillig, and the slithy toves
- Client: Response Content= TWAS BRILLIG, AND THE SLITHY TOVES
- Client: Request Content= Did gire and gymble in the wabe.
- Client: Response Content= DID GIRE AND GYMBLE IN THE WABE.
- Client: Request Content= All mimsy were the borogroves,
- Client: Response Content= ALL MIMSY WERE THE BOROGROVES,
- Client: Request Content= And the mome raths outgrabe.
- Client: Response Content= AND THE MOME RATHS OUTGRABE.
- Client: Closing connection
- Client: Closing JNDI context
-
+ 1. Make sure that a Qpid broker is running.
+ 2. In the java directory, use runSample.sh to run the program:
+ $ ./runSample.sh <class name> <arguments> \ No newline at end of file
diff --git a/qpid/java/client/src/main/java/client.bnd b/qpid/java/client/src/main/java/client.bnd
index 8f0f936583..0ddd163d4f 100755
--- a/qpid/java/client/src/main/java/client.bnd
+++ b/qpid/java/client/src/main/java/client.bnd
@@ -1,7 +1,26 @@
-ver: 0.7.0
-
-Bundle-SymbolicName: qpid-client
-Bundle-Version: ${ver}
-Export-Package: *;version=${ver}
+#
+# 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.
+#
+
+ver: 0.9.0
+
+Bundle-SymbolicName: qpid-client
+Bundle-Version: ${ver}
+Export-Package: *;version=${ver}
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
index dbd742070e..ee3e0767d4 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
@@ -1452,16 +1452,6 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect
{
_logger.info("Not a hard-error connection not closing: " + cause);
}
-
- // deliver the exception if there is a listener
- if (_exceptionListener != null)
- {
- _exceptionListener.onException(je);
- }
- else
- {
- _logger.error("Throwable Received but no listener set: " + cause);
- }
// if we are closing the connection, close sessions first
if (closer)
@@ -1475,6 +1465,16 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect
_logger.error("Error closing all sessions: " + e, e);
}
}
+
+ // deliver the exception if there is a listener
+ if (_exceptionListener != null)
+ {
+ _exceptionListener.onException(je);
+ }
+ else
+ {
+ _logger.error("Throwable Received but no listener set: " + cause);
+ }
}
}
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
index 24e5253cc8..75f71a99c0 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
@@ -577,7 +577,8 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic
try
{
boolean isTopic;
-
+ Map<String, Object> arguments = FieldTable.convertToMap(consumer.getArguments());
+
if (consumer.getDestination().getDestSyntax() == AMQDestination.DestSyntax.BURL)
{
isTopic = consumer.getDestination() instanceof AMQTopic ||
@@ -593,9 +594,12 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic
preAcquire = !consumer.isNoConsume() &&
(isTopic || consumer.getMessageSelector() == null ||
consumer.getMessageSelector().equals(""));
+
+ arguments.putAll(
+ (Map<? extends String, ? extends Object>) consumer.getDestination().getLink().getSubscription().getArgs());
}
- Map<String, Object> arguments = FieldTable.convertToMap(consumer.getArguments());
+
getQpidSession().messageSubscribe
(queueName.toString(), String.valueOf(tag),
getAcknowledgeMode() == NO_ACKNOWLEDGE ? MessageAcceptMode.NONE : MessageAcceptMode.EXPLICIT,
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
index 905bf5e111..4bac54b3e4 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
@@ -107,7 +107,7 @@ public abstract class BasicMessageConsumer<U extends UnprocessedMessage & AMQSes
/**
* We store the exclusive field in order to be able to reuse it when resubscribing in the event of failover
*/
- private final boolean _exclusive;
+ protected boolean _exclusive;
/**
* The acknowledge mode in force for this consumer. Note that the AMQP protocol allows different ack modes per
@@ -182,7 +182,7 @@ public abstract class BasicMessageConsumer<U extends UnprocessedMessage & AMQSes
_prefetchHigh = prefetchHigh;
_prefetchLow = prefetchLow;
_exclusive = exclusive;
-
+
_synchronousQueue = new LinkedBlockingQueue();
_autoClose = autoClose;
_noConsume = noConsume;
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
index d0f1f79631..699b52a6b1 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
@@ -490,4 +490,24 @@ public class BasicMessageConsumer_0_10 extends BasicMessageConsumer<UnprocessedM
clearReceiveQueue();
}
}
+
+ public boolean isExclusive()
+ {
+ AMQDestination dest = this.getDestination();
+ if (dest.getDestSyntax() == AMQDestination.DestSyntax.ADDR)
+ {
+ if (dest.getAddressType() == AMQDestination.TOPIC_TYPE)
+ {
+ return true;
+ }
+ else
+ {
+ return dest.getLink().getSubscription().isExclusive();
+ }
+ }
+ else
+ {
+ return _exclusive;
+ }
+ }
}
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
index cae11e3962..32c7ef29de 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java
@@ -223,8 +223,10 @@ public class AMQMessageDelegate_0_10 extends AbstractAMQMessageDelegate
String exchange = replyTo.getExchange();
String routingKey = replyTo.getRoutingKey();
- dest = generateDestination(exchange == null ? null : new AMQShortString(exchange),
- routingKey == null ? null : new AMQShortString(routingKey));
+ dest = generateDestination(exchange == null ? new AMQShortString("") :
+ new AMQShortString(exchange),
+ routingKey == null ? new AMQShortString(""):
+ new AMQShortString(routingKey));
_destinationCache.put(replyTo, new SoftReference<Destination>(dest));
}
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java b/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java
index 64d5b16db0..00503cc650 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java
@@ -27,6 +27,7 @@ import java.util.Map;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQDestination.Binding;
+import org.apache.qpid.client.messaging.address.Link.Subscription;
import org.apache.qpid.client.messaging.address.Node.ExchangeNode;
import org.apache.qpid.client.messaging.address.Node.QueueNode;
import org.apache.qpid.client.messaging.address.Node.UnknownNodeType;
@@ -264,6 +265,7 @@ public class AddressHelper
public Link getLink()
{
Link link = new Link();
+ link.setSubscription(new Subscription());
if (linkProps != null)
{
link.setDurable(linkProps.getBoolean(DURABLE) == null ? false
@@ -283,7 +285,8 @@ public class AddressHelper
.setProducerCapacity(capacityProps
.getInt(CAPACITY_TARGET) == null ? 0
: capacityProps.getInt(CAPACITY_TARGET));
- } else
+ }
+ else
{
int cap = linkProps.getInt(CAPACITY) == null ? 0 : linkProps
.getInt(CAPACITY);
@@ -292,6 +295,21 @@ public class AddressHelper
}
link.setFilter(linkProps.getString(FILTER));
// so far filter type not used
+
+ if (((Map) address.getOptions().get(LINK)).containsKey(X_SUBSCRIBE))
+ {
+ Map x_subscribe = (Map)((Map) address.getOptions().get(LINK)).get(X_SUBSCRIBE);
+
+ if (x_subscribe.containsKey(ARGUMENTS))
+ {
+ link.getSubscription().setArgs((Map<String,Object>)x_subscribe.get(ARGUMENTS));
+ }
+
+ boolean exclusive = x_subscribe.containsKey(EXCLUSIVE) ?
+ Boolean.parseBoolean((String)x_subscribe.get(EXCLUSIVE)): false;
+
+ link.getSubscription().setExclusive(exclusive);
+ }
}
return link;
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java b/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java
index 0ebcaf548b..a7d19d1bd5 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Link.java
@@ -20,6 +20,9 @@
*/
package org.apache.qpid.client.messaging.address;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.qpid.client.messaging.address.Node.QueueNode;
public class Link
@@ -34,6 +37,7 @@ public class Link
protected int _consumerCapacity = 0;
protected int _producerCapacity = 0;
protected Node node;
+ protected Subscription subscription;
public Node getNode()
{
@@ -114,4 +118,40 @@ public class Link
{
this.name = name;
}
+
+ public Subscription getSubscription()
+ {
+ return this.subscription;
+ }
+
+ public void setSubscription(Subscription subscription)
+ {
+ this.subscription = subscription;
+ }
+
+ public static class Subscription
+ {
+ private Map<String,Object> args = new HashMap<String,Object>();
+ private boolean exclusive = false;
+
+ public Map<String, Object> getArgs()
+ {
+ return args;
+ }
+
+ public void setArgs(Map<String, Object> args)
+ {
+ this.args = args;
+ }
+
+ public boolean isExclusive()
+ {
+ return exclusive;
+ }
+
+ public void setExclusive(boolean exclusive)
+ {
+ this.exclusive = exclusive;
+ }
+ }
}
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
index edfb4bb16b..10250a1ac0 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
@@ -66,7 +66,6 @@ import org.apache.qpid.transport.ConnectionSettings;
import org.apache.qpid.transport.Receiver;
import org.apache.qpid.transport.Sender;
import org.apache.qpid.transport.network.NetworkConnection;
-import org.apache.qpid.transport.network.NetworkTransport;
import org.apache.qpid.transport.network.OutgoingNetworkTransport;
import org.apache.qpid.transport.network.Transport;
import org.slf4j.Logger;
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
index 4236f20301..44376331ee 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
@@ -112,8 +112,7 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession
_protocolHandler = protocolHandler;
_protocolVersion = connection.getProtocolVersion();
_logger.info("Using ProtocolVersion for Session:" + _protocolVersion);
- _methodDispatcher = ClientMethodDispatcherImpl.newMethodDispatcher(ProtocolVersion.getLatestSupportedVersion(),
- this);
+ _methodDispatcher = ClientMethodDispatcherImpl.newMethodDispatcher(ProtocolVersion.getLatestSupportedVersion(), this);
_connection = connection;
}