diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-05-26 23:43:20 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-05-26 23:43:20 +0000 |
commit | 91491e533896be58438ba2dc0e199461b4320653 (patch) | |
tree | ee6e07494c2359ea5411d2a8ecdb75225c8b8c96 /java/client/example/src | |
parent | 2d92397a1209bf4c4645d76e3104abd1e58a2d66 (diff) | |
download | qpid-python-91491e533896be58438ba2dc0e199461b4320653.tar.gz |
Deleted the old examples to avoid confusion.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@948637 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/example/src')
58 files changed, 0 insertions, 3435 deletions
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Consumer.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Consumer.java deleted file mode 100644 index f84b16f485..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Consumer.java +++ /dev/null @@ -1,152 +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. - * - */ -package org.apache.qpid.example.jmsexample.direct; - -import java.util.Properties; - -import javax.jms.BytesMessage; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.naming.Context; -import javax.naming.InitialContext; - -/** - * The example creates a MessageConsumer on the specified - * Queue which is used to synchronously consume messages. - */ -public class Consumer -{ - /** - * Used in log output. - */ - private static final String CLASS = "Consumer"; - - - /** - * Run the message consumer example. - * @param args Command line arguments. - */ - public static void main(String[] args) - { - Consumer syncConsumer = new Consumer(); - syncConsumer.runTest(); - } - - /** - * Start the example. - */ - private void runTest() - { - try - { - // Load JNDI properties - Properties properties = new Properties(); - properties.load(this.getClass().getResourceAsStream("direct.properties")); - - //Create the initial context - Context ctx = new InitialContext(properties); - - // look up destination - Destination destination = (Destination)ctx.lookup("directQueue"); - - // Lookup the connection factory - ConnectionFactory conFac = (ConnectionFactory)ctx.lookup("qpidConnectionfactory"); - // create the connection - Connection connection = conFac.createConnection(); - - // As this application is using a MessageConsumer we need to set an ExceptionListener on the connection - // so that errors raised within the JMS client library can be reported to the application - System.out.println( - CLASS + ": Setting an ExceptionListener on the connection as sample uses a MessageConsumer"); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException jmse) - { - // The connection may have broken invoke reconnect code if available. - // The connection may have broken invoke reconnect code if available. - System.err.println(CLASS + ": The sample received an exception through the ExceptionListener"); - System.exit(0); - } - }); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Create a MessageConsumer - System.out.println(CLASS + ": Creating a MessageConsumer"); - MessageConsumer messageConsumer = session.createConsumer(destination); - - // Now the messageConsumer is set up we can start the connection - System.out.println(CLASS + ": Starting connection so MessageConsumer can receive messages"); - connection.start(); - - // Cycle round until all the messages are consumed. - Message message; - boolean end = false; - while (!end) - { - message = messageConsumer.receive(); - String text; - if (message instanceof TextMessage) - { - text = ((TextMessage) message).getText(); - } - else - { - byte[] body = new byte[(int) ((BytesMessage) message).getBodyLength()]; - ((BytesMessage) message).readBytes(body); - text = new String(body); - } - if (text.equals("That's all, folks!")) - { - System.out.println(CLASS + ": Received final message " + text); - end = true; - } - else - { - System.out.println(CLASS + ": Received message: " + text); - } - } - - // Close the connection to the server - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Listener.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Listener.java deleted file mode 100644 index d2e1180c9b..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Listener.java +++ /dev/null @@ -1,208 +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. - * - */ -package org.apache.qpid.example.jmsexample.direct; - -import java.util.Properties; - -import javax.jms.BytesMessage; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.naming.Context; -import javax.naming.InitialContext; - -/** - * The example creates a MessageConsumer on the specified - * Queue and uses a MessageListener with this MessageConsumer - * in order to enable asynchronous delivery. - */ -public class Listener implements MessageListener -{ - /* Used in log output. */ - private static final String CLASS = "Listener"; - - /** - * An object to synchronize on. - */ - private final static Object _lock = new Object(); - - /** - * A boolean to indicate a clean finish. - */ - private static boolean _finished = false; - - /** - * A boolean to indicate an unsuccesful finish. - */ - private static boolean _failed = false; - - - /** - * Run the message consumer example. - * @param args Command line arguments. - */ - public static void main(String[] args) - { - Listener listener = new Listener(); - listener.runTest(); - } - - /** - * Start the example. - */ - private void runTest() - { - try - { - // Load JNDI properties - Properties properties = new Properties(); - properties.load(this.getClass().getResourceAsStream("direct.properties")); - - //Create the initial context - Context ctx = new InitialContext(properties); - - // look up destination - Destination destination = (Destination)ctx.lookup("directQueue"); - - // Lookup the connection factory - ConnectionFactory conFac = (ConnectionFactory)ctx.lookup("qpidConnectionfactory"); - // create the connection - Connection connection = conFac.createConnection(); - - // As this application is using a MessageConsumer we need to set an ExceptionListener on the connection - // so that errors raised within the JMS client library can be reported to the application - System.out.println( - CLASS + ": Setting an ExceptionListener on the connection as sample uses a MessageConsumer"); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException jmse) - { - // The connection may have broken invoke reconnect code if available. - System.err.println(CLASS + ": The sample received an exception through the ExceptionListener"); - System.exit(0); - } - }); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses - // the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Create a MessageConsumer - System.out.println(CLASS + ": Creating a MessageConsumer"); - - MessageConsumer messageConsumer = session.createConsumer(destination); - - // Set a message listener on the messageConsumer - messageConsumer.setMessageListener(this); - - // Now the messageConsumer is set up we can start the connection - System.out.println(CLASS + ": Starting connection so MessageConsumer can receive messages"); - connection.start(); - - // Wait for the messageConsumer to have received all the messages it needs - synchronized (_lock) - { - while (!_finished && !_failed) - { - _lock.wait(); - } - } - - // If the MessageListener abruptly failed (probably due to receiving a non-text message) - if (_failed) - { - System.out.println(CLASS + ": This sample failed as it received unexpected messages"); - } - - // Close the connection to the server - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } - - /** - * This method is required by the <CODE>MessageListener</CODE> interface. It - * will be invoked when messages are available. - * After receiving the finish message (That's all, folks!) it releases a lock so that the - * main program may continue. - * - * @param message The message. - */ - public void onMessage(Message message) - { - try - { - String text; - if (message instanceof TextMessage) - { - text = ((TextMessage) message).getText(); - } - else - { - byte[] body = new byte[(int) ((BytesMessage) message).getBodyLength()]; - ((BytesMessage) message).readBytes(body); - text = new String(body); - } - if (text.equals("That's all, folks!")) - { - System.out.println(CLASS + ": Received final message " + text); - synchronized (_lock) - { - _finished = true; - _lock.notifyAll(); - } - } - else - { - System.out.println(CLASS + ": Received message: " + text); - } - } - catch (JMSException exp) - { - System.out.println(CLASS + ": Caught an exception handling a received message"); - exp.printStackTrace(); - synchronized (_lock) - { - _failed = true; - _lock.notifyAll(); - } - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Producer.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Producer.java deleted file mode 100644 index 259756764c..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/Producer.java +++ /dev/null @@ -1,138 +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. - * - */ -package org.apache.qpid.example.jmsexample.direct; - -import java.util.Properties; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.DeliveryMode; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.naming.Context; -import javax.naming.InitialContext; - -/** - * Message producer example, sends message to a queue. - */ -public class Producer -{ - /* Used in log output. */ - private static final String CLASS = "Producer"; - - private int numMessages = 10; - private short deliveryMode = DeliveryMode.NON_PERSISTENT; - - /** - * Create a Producer client. - */ - public Producer () - { - } - - /** - * Run the message producer example. - * @param args Command line arguments. - */ - public static void main(String[] args) - { - Producer producer = new Producer(); - producer.runTest(); - } - - private void runTest() - { - try - { - - // Load JNDI properties - Properties properties = new Properties(); - properties.load(this.getClass().getResourceAsStream("direct.properties")); - - //Create the initial context - Context ctx = new InitialContext(properties); - - // look up destination - Destination destination = (Destination)ctx.lookup("directQueue"); - - // Lookup the connection factory - ConnectionFactory conFac = (ConnectionFactory)ctx.lookup("qpidConnectionfactory"); - // create the connection - Connection connection = conFac.createConnection(); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException e) - { - e.printStackTrace(); - } - }); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // lookup the queue - //Queue destination = session.createQueue(_queueName); - - // Create a Message producer - System.out.println(CLASS + ": Creating a Message Producer"); - MessageProducer messageProducer = session.createProducer(destination); - - // Create a Message - TextMessage message; - System.out.println(CLASS + ": Creating a TestMessage to send to the destination"); - - // Loop to publish the requested number of messages. - for (int i = 1; i < numMessages + 1; i++) - { - // NOTE: We have NOT HAD TO START THE CONNECTION TO BEGIN SENDING messages, - // this is different to the consumer end as a CONSUMERS CONNECTIONS MUST BE STARTED BEFORE RECEIVING. - message = session.createTextMessage("Message " + i); - System.out.println(CLASS + ": Sending message: " + i); - messageProducer.send(message, deliveryMode, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); - } - - // And send a final message to indicate termination. - message = session.createTextMessage("That's all, folks!"); - messageProducer.send(message, deliveryMode, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); - - // Close the connection to the broker - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - System.err.println(CLASS + ": Caught an Exception: " + exp); - exp.printStackTrace(); - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/direct.properties b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/direct.properties deleted file mode 100644 index a2f5843e7a..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/direct.properties +++ /dev/null @@ -1,27 +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. -# -java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory - -# register some connection factories -# connectionfactory.[jndiname] = [ConnectionURL] -connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' - -# Register an AMQP destination in JNDI -# destination.[jniName] = [BindingURL] -destination.directQueue = direct://amq.direct//message_queue?routingkey='routing_key'
\ No newline at end of file diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify deleted file mode 100644 index 7f81a3a57b..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -# The JMS producer doesn't create qeueues so utilising the c++ declare_queues -cpp=$CPP/direct - -direct_consumer_java() -{ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Consumer -} - -direct_producer_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Producer -} - -clients $cpp/declare_queues direct_producer_java direct_consumer_java -outputs $cpp/declare_queues.out ./direct_producer_java.out ./direct_consumer_java.out diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify.in deleted file mode 100644 index c87e5716c8..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify.in +++ /dev/null @@ -1,35 +0,0 @@ -==== declare_queues.out -==== direct_producer_java.out -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 -==== direct_consumer_java.out -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 -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 diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_cpp_java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_cpp_java deleted file mode 100644 index a22162e075..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_cpp_java +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/direct - -direct_consumer_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Consumer -} - -clients $cpp/declare_queues $cpp/direct_producer direct_consumer_java -outputs $cpp/declare_queues.out $cpp/direct_producer.out ./direct_consumer_java.out - diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_cpp_java.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_cpp_java.in deleted file mode 100644 index b50692da1f..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_cpp_java.in +++ /dev/null @@ -1,20 +0,0 @@ -==== declare_queues.out -==== direct_producer.out -==== direct_consumer_java.out -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 -Consumer: Received message: Message 0 -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 final message That's all, folks! -Consumer: Closing connection -Consumer: Closing JNDI context diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_cpp b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_cpp deleted file mode 100644 index dc4b349808..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_cpp +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/direct - -direct_producer_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Producer -} - -clients $cpp/declare_queues direct_producer_java $cpp/listener -outputs $cpp/declare_queues.out ./direct_producer_java.out $cpp/listener.out - diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_cpp.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_cpp.in deleted file mode 100644 index 946c19953f..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_cpp.in +++ /dev/null @@ -1,30 +0,0 @@ -==== declare_queues.out -==== direct_producer_java.out -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 -==== listener.out -Message: Message 1 -Message: Message 2 -Message: Message 3 -Message: Message 4 -Message: Message 5 -Message: Message 6 -Message: Message 7 -Message: Message 8 -Message: Message 9 -Message: Message 10 -Message: That's all, folks! -Shutting down listener for message_queue diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_python b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_python deleted file mode 100644 index befa34d650..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_python +++ /dev/null @@ -1,9 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON/direct - -direct_producer_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Producer -} - -clients $py/declare_queues.py direct_producer_java $py/direct_consumer.py -outputs $py/declare_queues.py.out ./direct_producer_java.out $py/direct_consumer.py.out diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_python.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_python.in deleted file mode 100644 index e012405352..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_java_python.in +++ /dev/null @@ -1,29 +0,0 @@ -==== declare_queues.py.out -==== direct_producer_java.out -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 -==== direct_consumer.py.out -Message 1 -Message 2 -Message 3 -Message 4 -Message 5 -Message 6 -Message 7 -Message 8 -Message 9 -Message 10 -That's all, folks! diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_python_java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_python_java deleted file mode 100644 index b22b44b9a6..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_python_java +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON/direct - -direct_consumer_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Consumer -} - -clients $py/declare_queues.py $py/direct_producer.py direct_consumer_java -outputs $py/declare_queues.py.out $py/direct_producer.py.out ./direct_consumer_java.out - diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_python_java.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_python_java.in deleted file mode 100644 index 6a9c9fdd10..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/verify_python_java.in +++ /dev/null @@ -1,20 +0,0 @@ -==== declare_queues.py.out -==== direct_producer.py.out -==== direct_consumer_java.out -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 -Consumer: Received message: message 0 -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 final message That's all, folks! -Consumer: Closing connection -Consumer: Closing JNDI context diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Consumer.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Consumer.java deleted file mode 100755 index daa1b10b6b..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Consumer.java +++ /dev/null @@ -1,165 +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. - * - */ -package org.apache.qpid.example.jmsexample.fanout; - -import java.util.Properties; - -import javax.jms.BytesMessage; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.naming.Context; -import javax.naming.InitialContext; - -/** - * The example creates a MessageConsumer on the specified - * Queue which is used to synchronously consume messages. - */ -public class Consumer -{ - /** - * Used in log output. - */ - private static final String CLASS = "Consumer"; - - /** - * Create a Consumer client. - * - */ - public Consumer() - { - } - - /** - * Run the message consumer example. - * - * @param args Command line arguments. - */ - public static void main(String[] args) throws Exception - { - if (args.length == 0) - { - throw new Exception("You need to specify the JNDI name for the queue"); - } - Consumer syncConsumer = new Consumer(); - syncConsumer.runTest(args[0]); - } - - /** - * Start the example. - */ - private void runTest(String queueName) - { - try - { - // Load JNDI properties - Properties properties = new Properties(); - properties.load(this.getClass().getResourceAsStream("fanout.properties")); - - //Create the initial context - Context ctx = new InitialContext(properties); - - // look up destination - Destination destination = (Destination)ctx.lookup(queueName); - - // Lookup the connection factory - ConnectionFactory conFac = (ConnectionFactory)ctx.lookup("qpidConnectionfactory"); - // create the connection - Connection connection = conFac.createConnection(); - - // As this application is using a MessageConsumer we need to set an ExceptionListener on the connection - // so that errors raised within the JMS client library can be reported to the application - System.out.println( - CLASS + ": Setting an ExceptionListener on the connection as sample uses a MessageConsumer"); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException jmse) - { - // The connection may have broken invoke reconnect code if available. - // The connection may have broken invoke reconnect code if available. - System.err.println(CLASS + ": The sample received an exception through the ExceptionListener"); - System.exit(0); - } - }); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Create a MessageConsumer - System.out.println(CLASS + ": Creating a MessageConsumer"); - MessageConsumer messageConsumer = session.createConsumer(destination); - - // Now the messageConsumer is set up we can start the connection - System.out.println(CLASS + ": Starting connection so MessageConsumer can receive messages"); - connection.start(); - - // Cycle round until all the messages are consumed. - Message message; - boolean end = false; - while (!end) - { - message = messageConsumer.receive(); - String text; - if (message instanceof TextMessage) - { - text = ((TextMessage) message).getText(); - } - else - { - byte[] body = new byte[(int) ((BytesMessage) message).getBodyLength()]; - ((BytesMessage) message).readBytes(body); - text = new String(body); - } - if (text.equals("That's all, folks!")) - { - System.out.println(CLASS + ": Received final message " + text); - end = true; - } - else - { - System.out.println(CLASS + ": Received message: " + text); - } - } - - // Close the connection to the server - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - exp.printStackTrace(); - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Listener.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Listener.java deleted file mode 100755 index fb750693b2..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Listener.java +++ /dev/null @@ -1,201 +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. - * - */ -package org.apache.qpid.example.jmsexample.fanout; - -import java.util.Properties; - -import javax.jms.*; -import javax.naming.Context; -import javax.naming.InitialContext; - -/** - * The example creates a MessageConsumer on the specified - * Queue and uses a MessageListener with this MessageConsumer - * in order to enable asynchronous delivery. - */ -public class Listener implements MessageListener -{ - /* Used in log output. */ - private static final String CLASS = "Listener"; - - /** - * An object to synchronize on. - */ - private final Object _lock = new Object(); - - /** - * A boolean to indicate a clean finish. - */ - private boolean _finished = false; - - /** - * A boolean to indicate an unsuccesful finish. - */ - private boolean _failed = false; - - - - /** - * Run the message consumer example. - * - * @param args Command line arguments. - */ - public static void main(String[] args) throws Exception - { - if (args.length == 0) - { - throw new Exception("You need to specify the JNDI name for the queue"); - } - Listener listener = new Listener(); - listener.runTest(args[0]); - } - - /** - * Start the example. - */ - private void runTest(String queueName) - { - try - { - Properties properties = new Properties(); - properties.load(this.getClass().getResourceAsStream("fanout.properties")); - - //Create the initial context - Context ctx = new InitialContext(properties); - - Destination destination = (Destination)ctx.lookup(queueName); - - // Declare the connection - ConnectionFactory conFac = (ConnectionFactory)ctx.lookup("qpidConnectionfactory"); - Connection connection = conFac.createConnection(); - - // As this application is using a MessageConsumer we need to set an ExceptionListener on the connection - // so that errors raised within the JMS client library can be reported to the application - System.out.println( - CLASS + ": Setting an ExceptionListener on the connection as sample uses a MessageConsumer"); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException jmse) - { - // The connection may have broken invoke reconnect code if available. - System.err.println(CLASS + ": The sample received an exception through the ExceptionListener"); - System.exit(0); - } - }); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses - // the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Create a MessageConsumer - System.out.println(CLASS + ": Creating a MessageConsumer"); - - MessageConsumer messageConsumer = session.createConsumer(destination); - - // Set a message listener on the messageConsumer - messageConsumer.setMessageListener(this); - - // Now the messageConsumer is set up we can start the connection - System.out.println(CLASS + ": Starting connection so MessageConsumer can receive messages"); - connection.start(); - - // Wait for the messageConsumer to have received all the messages it needs - synchronized (_lock) - { - while (!_finished && !_failed) - { - _lock.wait(); - } - } - - // If the MessageListener abruptly failed (probably due to receiving a non-text message) - if (_failed) - { - System.out.println(CLASS + ": This sample failed as it received unexpected messages"); - } - - // Close the connection to the server - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } - - /** - * This method is required by the <CODE>MessageListener</CODE> interface. It - * will be invoked when messages are available. - * After receiving the finish message (That's all, folks!) it releases a lock so that the - * main program may continue. - * - * @param message The message. - */ - public void onMessage(Message message) - { - try - { - String text; - if (message instanceof TextMessage) - { - text = ((TextMessage) message).getText(); - } - else - { - byte[] body = new byte[(int) ((BytesMessage) message).getBodyLength()]; - ((BytesMessage) message).readBytes(body); - text = new String(body); - } - if (text.equals("That's all, folks!")) - { - System.out.println(CLASS + ": Received final message " + text); - synchronized (_lock) - { - _finished = true; - _lock.notifyAll(); - } - } - else - { - System.out.println(CLASS + ": Received message: " + text); - } - } - catch (JMSException exp) - { - System.out.println(CLASS + ": Caught an exception handling a received message"); - exp.printStackTrace(); - synchronized (_lock) - { - _failed = true; - _lock.notifyAll(); - } - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Producer.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Producer.java deleted file mode 100755 index 2e360f37bb..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Producer.java +++ /dev/null @@ -1,113 +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. - * - */ -package org.apache.qpid.example.jmsexample.fanout; - -import java.util.Properties; - -import javax.jms.*; -import javax.naming.Context; -import javax.naming.InitialContext; - -/** - * Message producer example, sends message to a queue. - */ -public class Producer -{ - /* Used in log output. */ - private static final String CLASS = "Producer"; - - /* The queue name */ - private int numMessages = 10; - private short deliveryMode = DeliveryMode.NON_PERSISTENT; - - - /** - * Run the message producer example. - * @param args Command line arguments. - */ - public static void main(String[] args) - { - Producer producer = new Producer(); - producer.runTest(); - } - - private void runTest() - { - try - { - - Properties properties = new Properties(); - properties.load(this.getClass().getResourceAsStream("fanout.properties")); - - //Create the initial context - Context ctx = new InitialContext(properties); - - Destination destination = (Destination)ctx.lookup("fanoutQueue"); - - // Declare the connection - ConnectionFactory conFac = (ConnectionFactory)ctx.lookup("qpidConnectionfactory"); - Connection connection = conFac.createConnection(); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // lookup the queue - //Queue destination = session.createQueue(_queueName); - - // Create a Message producer - System.out.println(CLASS + ": Creating a Message Producer"); - MessageProducer messageProducer = session.createProducer(destination); - - // Create a Message - TextMessage message; - System.out.println(CLASS + ": Creating a TestMessage to send to the destination"); - - // Loop to publish the requested number of messages. - for (int i = 1; i < numMessages + 1; i++) - { - // NOTE: We have NOT HAD TO START THE CONNECTION TO BEGIN SENDING messages, - // this is different to the consumer end as a CONSUMERS CONNECTIONS MUST BE STARTED BEFORE RECEIVING. - message = session.createTextMessage("Message " + i); - System.out.println(CLASS + ": Sending message: " + i); - messageProducer.send(message, deliveryMode, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); - } - - // And send a final message to indicate termination. - message = session.createTextMessage("That's all, folks!"); - messageProducer.send(message, deliveryMode, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); - - // Close the connection to the broker - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - System.err.println(CLASS + ": Caught an Exception: " + exp); - exp.printStackTrace(); - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/fanout.properties b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/fanout.properties deleted file mode 100644 index 901994541d..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/fanout.properties +++ /dev/null @@ -1,33 +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. -# -java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory - - -# register some connection factories -# connectionfactory.[jndiname] = [ConnectionURL] -connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' - -# Register an AMQP destination in JNDI -# destination.[jniName] = [BindingURL] -destination.fanoutQueue1 = fanout://amq.fanout//message_queue1 -destination.fanoutQueue2 = fanout://amq.fanout//message_queue2 -destination.fanoutQueue3 = fanout://amq.fanout//message_queue3 - -# for producer -destination.fanoutQueue = fanout://amq.fanout//message_queue
\ No newline at end of file diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify deleted file mode 100644 index 98c866da99..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify +++ /dev/null @@ -1,36 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -# The JMS producer doesn't create qeueues so utilising the c++ declare_queues -cpp=$CPP/fanout - -fanout_listener_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Listener $1 -} - -fanout_producer_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Producer -} - -background "can receive messages" fanout_listener_java fanoutQueue1 -background "can receive messages" fanout_listener_java fanoutQueue2 -background "can receive messages" fanout_listener_java fanoutQueue3 -clients fanout_producer_java -outputs ./fanout_producer_java.out "./fanout_listener_java.out | remove_uuid" "./fanout_listener_javaX.out | remove_uuid" "./fanout_listener_javaXX.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify.in deleted file mode 100644 index c36a515c2a..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify.in +++ /dev/null @@ -1,70 +0,0 @@ -==== fanout_producer_java.out -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 -==== fanout_listener_java.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: Message 1 -Listener: Received message: Message 2 -Listener: Received message: Message 3 -Listener: Received message: Message 4 -Listener: Received message: Message 5 -Listener: Received message: Message 6 -Listener: Received message: Message 7 -Listener: Received message: Message 8 -Listener: Received message: Message 9 -Listener: Received message: Message 10 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context -==== fanout_listener_javaX.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: Message 1 -Listener: Received message: Message 2 -Listener: Received message: Message 3 -Listener: Received message: Message 4 -Listener: Received message: Message 5 -Listener: Received message: Message 6 -Listener: Received message: Message 7 -Listener: Received message: Message 8 -Listener: Received message: Message 9 -Listener: Received message: Message 10 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context -==== fanout_listener_javaXX.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: Message 1 -Listener: Received message: Message 2 -Listener: Received message: Message 3 -Listener: Received message: Message 4 -Listener: Received message: Message 5 -Listener: Received message: Message 6 -Listener: Received message: Message 7 -Listener: Received message: Message 8 -Listener: Received message: Message 9 -Listener: Received message: Message 10 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_cpp_java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_cpp_java deleted file mode 100644 index ab8d37a0d8..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_cpp_java +++ /dev/null @@ -1,13 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -# The JMS producer doesn't create qeueues so utilising the c++ declare_queues -cpp=$CPP/fanout - -fanout_listener_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Listener $1 -} - -background "can receive messages" fanout_listener_java fanoutQueue1 -background "can receive messages" fanout_listener_java fanoutQueue2 -background "can receive messages" fanout_listener_java fanoutQueue3 -clients $cpp/fanout_producer -outputs $cpp/fanout_producer.out "./fanout_listener_java.out | remove_uuid" "./fanout_listener_javaX.out | remove_uuid" "./fanout_listener_javaXX.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_cpp_java.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_cpp_java.in deleted file mode 100644 index 905fe3d0bc..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_cpp_java.in +++ /dev/null @@ -1,55 +0,0 @@ -==== fanout_producer.out -==== fanout_listener_java.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: Message 0 -Listener: Received message: Message 1 -Listener: Received message: Message 2 -Listener: Received message: Message 3 -Listener: Received message: Message 4 -Listener: Received message: Message 5 -Listener: Received message: Message 6 -Listener: Received message: Message 7 -Listener: Received message: Message 8 -Listener: Received message: Message 9 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context -==== fanout_listener_javaX.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: Message 0 -Listener: Received message: Message 1 -Listener: Received message: Message 2 -Listener: Received message: Message 3 -Listener: Received message: Message 4 -Listener: Received message: Message 5 -Listener: Received message: Message 6 -Listener: Received message: Message 7 -Listener: Received message: Message 8 -Listener: Received message: Message 9 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context -==== fanout_listener_javaXX.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: Message 0 -Listener: Received message: Message 1 -Listener: Received message: Message 2 -Listener: Received message: Message 3 -Listener: Received message: Message 4 -Listener: Received message: Message 5 -Listener: Received message: Message 6 -Listener: Received message: Message 7 -Listener: Received message: Message 8 -Listener: Received message: Message 9 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_cpp b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_cpp deleted file mode 100644 index df923e6354..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_cpp +++ /dev/null @@ -1,13 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -# The JMS producer doesn't create qeueues so utilising the c++ declare_queues -cpp=$CPP/fanout - -fanout_producer_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Producer -} - -background "Listening" $cpp/listener -background "Listening" $cpp/listener -background "Listening" $cpp/listener -clients fanout_producer_java -outputs ./fanout_producer_java.out "$cpp/listener.out | remove_uuid" "$cpp/listenerX.out | remove_uuid" "$cpp/listenerXX.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_cpp.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_cpp.in deleted file mode 100644 index 03e75e39c6..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_cpp.in +++ /dev/null @@ -1,58 +0,0 @@ -==== fanout_producer_java.out -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 -==== listener.out | remove_uuid -Listening -Message: Message 1 -Message: Message 2 -Message: Message 3 -Message: Message 4 -Message: Message 5 -Message: Message 6 -Message: Message 7 -Message: Message 8 -Message: Message 9 -Message: Message 10 -Message: That's all, folks! -Shutting down listener for -==== listenerX.out | remove_uuid -Listening -Message: Message 1 -Message: Message 2 -Message: Message 3 -Message: Message 4 -Message: Message 5 -Message: Message 6 -Message: Message 7 -Message: Message 8 -Message: Message 9 -Message: Message 10 -Message: That's all, folks! -Shutting down listener for -==== listenerXX.out | remove_uuid -Listening -Message: Message 1 -Message: Message 2 -Message: Message 3 -Message: Message 4 -Message: Message 5 -Message: Message 6 -Message: Message 7 -Message: Message 8 -Message: Message 9 -Message: Message 10 -Message: That's all, folks! -Shutting down listener for diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_python b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_python deleted file mode 100644 index 5f8701882d..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_python +++ /dev/null @@ -1,13 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -# The JMS producer doesn't create qeueues so utilising the c++ declare_queues -py=$PYTHON/fanout - -fanout_producer_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Producer -} - -background "Subscribed" $py/fanout_consumer.py -background "Subscribed" $py/fanout_consumer.py -background "Subscribed" $py/fanout_consumer.py -clients fanout_producer_java -outputs ./fanout_producer_java.out "$py/fanout_consumer.py.out | remove_uuid" "$py/fanout_consumer.pyX.out | remove_uuid" "$py/fanout_consumer.pyXX.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_python.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_python.in deleted file mode 100644 index 0089e55c16..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_java_python.in +++ /dev/null @@ -1,55 +0,0 @@ -==== fanout_producer_java.out -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 -==== fanout_consumer.py.out | remove_uuid -Subscribed to queue -Message 1 -Message 2 -Message 3 -Message 4 -Message 5 -Message 6 -Message 7 -Message 8 -Message 9 -Message 10 -That's all, folks! -==== fanout_consumer.pyX.out | remove_uuid -Subscribed to queue -Message 1 -Message 2 -Message 3 -Message 4 -Message 5 -Message 6 -Message 7 -Message 8 -Message 9 -Message 10 -That's all, folks! -==== fanout_consumer.pyXX.out | remove_uuid -Subscribed to queue -Message 1 -Message 2 -Message 3 -Message 4 -Message 5 -Message 6 -Message 7 -Message 8 -Message 9 -Message 10 -That's all, folks! diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_python_java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_python_java deleted file mode 100644 index 72f263fd3d..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_python_java +++ /dev/null @@ -1,13 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -# The JMS producer doesn't create qeueues so utilising the c++ declare_queues -py=$PYTHON/fanout - -fanout_listener_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Listener $1 -} - -background "can receive messages" fanout_listener_java fanoutQueue1 -background "can receive messages" fanout_listener_java fanoutQueue2 -background "can receive messages" fanout_listener_java fanoutQueue3 -clients $py/fanout_producer.py -outputs $py/fanout_producer.py.out "./fanout_listener_java.out | remove_uuid" "./fanout_listener_javaX.out | remove_uuid" "./fanout_listener_javaXX.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_python_java.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_python_java.in deleted file mode 100644 index 1d8e1c2790..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/verify_python_java.in +++ /dev/null @@ -1,55 +0,0 @@ -==== fanout_producer.py.out -==== fanout_listener_java.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: message 0 -Listener: Received message: message 1 -Listener: Received message: message 2 -Listener: Received message: message 3 -Listener: Received message: message 4 -Listener: Received message: message 5 -Listener: Received message: message 6 -Listener: Received message: message 7 -Listener: Received message: message 8 -Listener: Received message: message 9 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context -==== fanout_listener_javaX.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: message 0 -Listener: Received message: message 1 -Listener: Received message: message 2 -Listener: Received message: message 3 -Listener: Received message: message 4 -Listener: Received message: message 5 -Listener: Received message: message 6 -Listener: Received message: message 7 -Listener: Received message: message 8 -Listener: Received message: message 9 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context -==== fanout_listener_javaXX.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: message 0 -Listener: Received message: message 1 -Listener: Received message: message 2 -Listener: Received message: message 3 -Listener: Received message: message 4 -Listener: Received message: message 5 -Listener: Received message: message 6 -Listener: Received message: message 7 -Listener: Received message: message 8 -Listener: Received message: message 9 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java deleted file mode 100644 index 8fa8191de9..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java +++ /dev/null @@ -1,68 +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. - * - */ -package org.apache.qpid.example.jmsexample.hello; - -import javax.jms.*; -import javax.naming.Context; -import javax.naming.InitialContext; -import java.util.Properties; - - -public class Hello { - - public Hello() { - } - - public static void main(String[] args) { - Hello producer = new Hello(); - producer.runTest(); - } - - private void runTest() { - try { - Properties properties = new Properties(); - properties.load(this.getClass().getResourceAsStream("hello.properties")); - Context context = new InitialContext(properties); - - ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("qpidConnectionfactory"); - Connection connection = connectionFactory.createConnection(); - connection.start(); - - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - Destination destination = (Destination) context.lookup("topicExchange"); - - MessageProducer messageProducer = session.createProducer(destination); - MessageConsumer messageConsumer = session.createConsumer(destination); - - TextMessage message = session.createTextMessage("Hello world!"); - messageProducer.send(message); - - message = (TextMessage)messageConsumer.receive(); - System.out.println(message.getText()); - - connection.close(); - context.close(); - } - catch (Exception exp) { - exp.printStackTrace(); - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/hello.properties b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/hello.properties deleted file mode 100644 index 27ea66b318..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/hello.properties +++ /dev/null @@ -1,27 +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. -# -java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory - -# register some connection factories -# connectionfactory.[jndiname] = [ConnectionURL] -connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' - -# Register an AMQP destination in JNDI -# destination.[jniName] = [Address Format] -destination.topicExchange = amq.topic diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/Listener.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/Listener.java deleted file mode 100644 index 1a3d40041d..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/Listener.java +++ /dev/null @@ -1,214 +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. - */ -package org.apache.qpid.example.jmsexample.pubsub; - -import java.util.Properties; - -import javax.jms.BytesMessage; -import javax.jms.ConnectionFactory; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.jms.Topic; -import javax.jms.TopicConnection; -import javax.jms.TopicSession; -import javax.naming.Context; -import javax.naming.InitialContext; - -/** - * The example creates a TopicSubscriber on the specified - * Topic and uses a MessageListener with this TopicSubscriber - * in order to enable asynchronous delivery. - */ -public class Listener -{ - /* Used in log output. */ - private static final String CLASS="Listener"; - - /* An object to synchronize on. */ - private final static Object _lock=new Object(); - - /* A boolean to indicate a clean finish. */ - private static int _finished=0; - - /* A boolean to indicate an unsuccesful finish. */ - private static boolean _failed=false; - - /** - * Run the message consumer example. - * - * @param args Command line arguments. - */ - public static void main(String[] args) - { - Listener listener=new Listener(); - listener.runTest(); - } - - private void createListener(Context ctx,TopicSession session,String topicName) throws Exception{ - // lookup the topic usa - Topic topic=(Topic) ctx.lookup(topicName); - // Create a Message Subscriber - System.out.println(CLASS + ": Creating a Message Subscriber for topic " + topicName); - javax.jms.TopicSubscriber messageSubscriber=session.createSubscriber(topic); - - // Set a message listener on the messageConsumer - messageSubscriber.setMessageListener(new MyMessageListener(topicName)); - - } - - /** - * Start the example. - */ - private void runTest() - { - try - { - Properties properties=new Properties(); - properties.load(this.getClass().getResourceAsStream("pubsub.properties")); - - //Create the initial context - Context ctx=new InitialContext(properties); - - // Declare the connection - ConnectionFactory conFac=(ConnectionFactory) ctx.lookup("qpidConnectionfactory"); - TopicConnection connection=(TopicConnection) conFac.createConnection(); - - // As this application is using a TopicSubscriber we need to set an ExceptionListener on the connection - // so that errors raised within the JMS client library can be reported to the application - System.out.println( - CLASS + ": Setting an ExceptionListener on the connection as sample uses a TopicSubscriber"); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException jmse) - { - // The connection may have broken invoke reconnect code if available. - System.err.println(CLASS + ": The sample received an exception through the ExceptionListener"); - System.exit(0); - } - }); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses - // the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - TopicSession session=connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); - - createListener(ctx,session,"usa"); - createListener(ctx,session,"europe"); - createListener(ctx,session,"news"); - createListener(ctx,session,"weather"); - - // Now the messageConsumer is set up we can start the connection - System.out.println(CLASS + ": Starting connection so TopicSubscriber can receive messages"); - connection.start(); - - // Wait for the messageConsumer to have received all the messages it needs - synchronized (_lock) - { - while (_finished < 4 && !_failed) - { - _lock.wait(); - } - } - - // If the MessageListener abruptly failed (probably due to receiving a non-text message) - if (_failed) - { - System.out.println(CLASS + ": This sample failed as it received unexpected messages"); - } - - // Close the connection to the server - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - exp.printStackTrace(); - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } - - private class MyMessageListener implements MessageListener - { - /* The topic this subscriber is subscribing to */ - private String _topicName; - - public MyMessageListener(String topicName) - { - _topicName=topicName; - } - - /** - * This method is required by the <CODE>MessageListener</CODE> interface. It - * will be invoked when messages are available. - * After receiving the final message it releases a lock so that the - * main program may continue. - * - * @param message The message. - */ - public void onMessage(Message message) - { - try - { - String text; - if (message instanceof TextMessage) - { - text=((TextMessage) message).getText(); - } - else - { - byte[] body=new byte[(int) ((BytesMessage) message).getBodyLength()]; - ((BytesMessage) message).readBytes(body); - text=new String(body); - } - if (text.equals("That's all, folks!")) - { - System.out.println(CLASS + ": Shutting down listener for " + _topicName); - synchronized (_lock) - { - _finished++; - _lock.notifyAll(); - } - } - else - { - System.out.println(CLASS + ": Received message for topic: " + _topicName + ": " + text); - } - } - catch (JMSException exp) - { - System.out.println(CLASS + ": Caught an exception handling a received message"); - exp.printStackTrace(); - synchronized (_lock) - { - _failed=true; - _lock.notifyAll(); - } - } - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/Publisher.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/Publisher.java deleted file mode 100644 index 360b2c6aed..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/Publisher.java +++ /dev/null @@ -1,133 +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. - * - */ -package org.apache.qpid.example.jmsexample.pubsub; - - -import javax.jms.*; -import javax.naming.Context; -import javax.naming.InitialContext; -import java.util.Properties; - -/** - * Publish messages to topics - */ -public class Publisher -{ - /* Used in log output. */ - private static final String CLASS="Publisher"; - - /** - * Run the message producer example. - * @param args Command line arguments. - */ - public static void main(String[] args) - { - Publisher publisher = new Publisher(); - publisher.runTest(); - } - - private void runTest() - { - try - { - Properties properties=new Properties(); - properties.load(this.getClass().getResourceAsStream("pubsub.properties")); - - //Create the initial context - Context ctx=new InitialContext(properties); - - // Declare the connection - ConnectionFactory conFac=(ConnectionFactory) ctx.lookup("qpidConnectionfactory"); - TopicConnection connection= (TopicConnection) conFac.createConnection(); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - TopicSession session=connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); - - // Create a Message - TextMessage message; - System.out.println(CLASS + ": Creating a TestMessage to send to the topics"); - message=session.createTextMessage(); - - // lookup the topics usa.weather - Topic topic = (Topic)ctx.lookup("usa.weather"); - // Create a Message Publisher - System.out.println(CLASS + ": Creating a Message Publisher for topic usa.weather"); - TopicPublisher messagePublisher=session.createPublisher(topic); - publishMessages(message, messagePublisher); - - // lookup the topics usa.news - topic = (Topic)ctx.lookup("usa.news"); - // Create a Message Publisher - System.out.println(CLASS + ": Creating a Message Publisher for topic usa.news"); - messagePublisher=session.createPublisher(topic); - publishMessages(message, messagePublisher); - - // lookup the topics europe.weather - topic = (Topic)ctx.lookup("europe.weather"); - // Create a Message Publisher - System.out.println(CLASS + ": Creating a Message Publisher for topic europe.weather"); - messagePublisher=session.createPublisher(topic); - publishMessages(message, messagePublisher); - - // lookup the topics europe.news - topic = (Topic)ctx.lookup("europe.news"); - // Create a Message Publisher - System.out.println(CLASS + ": Creating a Message Publisher for topic europe.news"); - messagePublisher = session.createPublisher(topic); - publishMessages(message, messagePublisher); - - // send the final message - message=session.createTextMessage("That's all, folks!"); - topic = (Topic)ctx.lookup("control"); - // Create a Message Publisher - messagePublisher = session.createPublisher(topic); - messagePublisher - .send(message, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); - - - // Close the connection to the broker - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } - - private void publishMessages(TextMessage message, TopicPublisher messagePublisher) throws JMSException - { - // Loop to publish 5 messages. - for (int i=1; i <= 6; i++) - { - message.setText("message " + i); - System.out.println(CLASS + ": Sending " + message.getText()); - messagePublisher - .send(message, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/pubsub.properties b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/pubsub.properties deleted file mode 100644 index 91c3de721b..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/pubsub.properties +++ /dev/null @@ -1,36 +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. -# -java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory - - -# register some connection factories -# connectionfactory.[jndiname] = [ConnectionURL] -connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' - -# register some topics in JNDI using the form -# topic.[jndiName] = [physicalName] -topic.usa.weather = usa.weather,control -topic.usa.news = usa.news,control -topic.europe.weather = europe.weather,control -topic.europe.news = europe.news,control -topic.weather = #.weather,control -topic.news = #.news,control -topic.europe = europe.#,control -topic.usa = usa.#,control -topic.control = control
\ No newline at end of file diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify deleted file mode 100644 index 363af252ad..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify +++ /dev/null @@ -1,33 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/pub-sub - -topic_listener_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Listener -} - -topic_publisher_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Publisher -} - -background "can receive messages" topic_listener_java -clients topic_publisher_java -outputs ./topic_publisher_java.out "topic_listener_java.out | remove_uuid | sort" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify.in deleted file mode 100644 index 6e3074e611..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify.in +++ /dev/null @@ -1,95 +0,0 @@ -==== topic_publisher_java.out -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 -==== topic_listener_java.out | remove_uuid | sort -Listener: Closing connection -Listener: Closing JNDI context -Listener: Creating a Message Subscriber for topic europe -Listener: Creating a Message Subscriber for topic news -Listener: Creating a Message Subscriber for topic usa -Listener: Creating a Message Subscriber for topic weather -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Received message for topic: europe: message 1 -Listener: Received message for topic: europe: message 1 -Listener: Received message for topic: europe: message 2 -Listener: Received message for topic: europe: message 2 -Listener: Received message for topic: europe: message 3 -Listener: Received message for topic: europe: message 3 -Listener: Received message for topic: europe: message 4 -Listener: Received message for topic: europe: message 4 -Listener: Received message for topic: europe: message 5 -Listener: Received message for topic: europe: message 5 -Listener: Received message for topic: europe: message 6 -Listener: Received message for topic: europe: message 6 -Listener: Received message for topic: news: message 1 -Listener: Received message for topic: news: message 1 -Listener: Received message for topic: news: message 2 -Listener: Received message for topic: news: message 2 -Listener: Received message for topic: news: message 3 -Listener: Received message for topic: news: message 3 -Listener: Received message for topic: news: message 4 -Listener: Received message for topic: news: message 4 -Listener: Received message for topic: news: message 5 -Listener: Received message for topic: news: message 5 -Listener: Received message for topic: news: message 6 -Listener: Received message for topic: news: message 6 -Listener: Received message for topic: usa: message 1 -Listener: Received message for topic: usa: message 1 -Listener: Received message for topic: usa: message 2 -Listener: Received message for topic: usa: message 2 -Listener: Received message for topic: usa: message 3 -Listener: Received message for topic: usa: message 3 -Listener: Received message for topic: usa: message 4 -Listener: Received message for topic: usa: message 4 -Listener: Received message for topic: usa: message 5 -Listener: Received message for topic: usa: message 5 -Listener: Received message for topic: usa: message 6 -Listener: Received message for topic: usa: message 6 -Listener: Received message for topic: weather: message 1 -Listener: Received message for topic: weather: message 1 -Listener: Received message for topic: weather: message 2 -Listener: Received message for topic: weather: message 2 -Listener: Received message for topic: weather: message 3 -Listener: Received message for topic: weather: message 3 -Listener: Received message for topic: weather: message 4 -Listener: Received message for topic: weather: message 4 -Listener: Received message for topic: weather: message 5 -Listener: Received message for topic: weather: message 5 -Listener: Received message for topic: weather: message 6 -Listener: Received message for topic: weather: message 6 -Listener: Setting an ExceptionListener on the connection as sample uses a TopicSubscriber -Listener: Shutting down listener for europe -Listener: Shutting down listener for news -Listener: Shutting down listener for usa -Listener: Shutting down listener for weather -Listener: Starting connection so TopicSubscriber can receive messages diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_cpp_java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_cpp_java deleted file mode 100644 index e73c164b77..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_cpp_java +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/pub-sub - -topic_listener_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Listener -} - -background "can receive messages" topic_listener_java -clients $cpp/topic_publisher -outputs $cpp/topic_publisher.out "topic_listener_java.out | remove_uuid | sort" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_cpp_java.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_cpp_java.in deleted file mode 100644 index 62cc76baec..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_cpp_java.in +++ /dev/null @@ -1,55 +0,0 @@ -==== topic_publisher.out -==== topic_listener_java.out | remove_uuid | sort -Listener: Closing connection -Listener: Closing JNDI context -Listener: Creating a Message Subscriber for topic europe -Listener: Creating a Message Subscriber for topic news -Listener: Creating a Message Subscriber for topic usa -Listener: Creating a Message Subscriber for topic weather -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Received message for topic: europe: Message 0 -Listener: Received message for topic: europe: Message 0 -Listener: Received message for topic: europe: Message 1 -Listener: Received message for topic: europe: Message 1 -Listener: Received message for topic: europe: Message 2 -Listener: Received message for topic: europe: Message 2 -Listener: Received message for topic: europe: Message 3 -Listener: Received message for topic: europe: Message 3 -Listener: Received message for topic: europe: Message 4 -Listener: Received message for topic: europe: Message 4 -Listener: Received message for topic: news: Message 0 -Listener: Received message for topic: news: Message 0 -Listener: Received message for topic: news: Message 1 -Listener: Received message for topic: news: Message 1 -Listener: Received message for topic: news: Message 2 -Listener: Received message for topic: news: Message 2 -Listener: Received message for topic: news: Message 3 -Listener: Received message for topic: news: Message 3 -Listener: Received message for topic: news: Message 4 -Listener: Received message for topic: news: Message 4 -Listener: Received message for topic: usa: Message 0 -Listener: Received message for topic: usa: Message 0 -Listener: Received message for topic: usa: Message 1 -Listener: Received message for topic: usa: Message 1 -Listener: Received message for topic: usa: Message 2 -Listener: Received message for topic: usa: Message 2 -Listener: Received message for topic: usa: Message 3 -Listener: Received message for topic: usa: Message 3 -Listener: Received message for topic: usa: Message 4 -Listener: Received message for topic: usa: Message 4 -Listener: Received message for topic: weather: Message 0 -Listener: Received message for topic: weather: Message 0 -Listener: Received message for topic: weather: Message 1 -Listener: Received message for topic: weather: Message 1 -Listener: Received message for topic: weather: Message 2 -Listener: Received message for topic: weather: Message 2 -Listener: Received message for topic: weather: Message 3 -Listener: Received message for topic: weather: Message 3 -Listener: Received message for topic: weather: Message 4 -Listener: Received message for topic: weather: Message 4 -Listener: Setting an ExceptionListener on the connection as sample uses a TopicSubscriber -Listener: Shutting down listener for europe -Listener: Shutting down listener for news -Listener: Shutting down listener for usa -Listener: Shutting down listener for weather -Listener: Starting connection so TopicSubscriber can receive messages diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_cpp b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_cpp deleted file mode 100644 index 0b877566d3..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_cpp +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/pub-sub - -topic_publisher_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Publisher -} - -background "Listening" $cpp/topic_listener -clients topic_publisher_java -outputs ./topic_publisher_java.out "$cpp/topic_listener.out | remove_uuid | sort" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_cpp.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_cpp.in deleted file mode 100644 index 8c5c26eaca..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_cpp.in +++ /dev/null @@ -1,99 +0,0 @@ -==== topic_publisher_java.out -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 -==== topic_listener.out | remove_uuid | sort -Declaring queue: europe -Declaring queue: news -Declaring queue: usa -Declaring queue: weather -Listening for messages ... -Message: message 1 from europe -Message: message 1 from europe -Message: message 1 from news -Message: message 1 from news -Message: message 1 from usa -Message: message 1 from usa -Message: message 1 from weather -Message: message 1 from weather -Message: message 2 from europe -Message: message 2 from europe -Message: message 2 from news -Message: message 2 from news -Message: message 2 from usa -Message: message 2 from usa -Message: message 2 from weather -Message: message 2 from weather -Message: message 3 from europe -Message: message 3 from europe -Message: message 3 from news -Message: message 3 from news -Message: message 3 from usa -Message: message 3 from usa -Message: message 3 from weather -Message: message 3 from weather -Message: message 4 from europe -Message: message 4 from europe -Message: message 4 from news -Message: message 4 from news -Message: message 4 from usa -Message: message 4 from usa -Message: message 4 from weather -Message: message 4 from weather -Message: message 5 from europe -Message: message 5 from europe -Message: message 5 from news -Message: message 5 from news -Message: message 5 from usa -Message: message 5 from usa -Message: message 5 from weather -Message: message 5 from weather -Message: message 6 from europe -Message: message 6 from europe -Message: message 6 from news -Message: message 6 from news -Message: message 6 from usa -Message: message 6 from usa -Message: message 6 from weather -Message: message 6 from weather -Message: That's all, folks! from europe -Message: That's all, folks! from news -Message: That's all, folks! from usa -Message: That's all, folks! from weather -Shutting down listener for europe -Shutting down listener for news -Shutting down listener for usa -Shutting down listener for weather -Subscribing to queue europe -Subscribing to queue news -Subscribing to queue usa -Subscribing to queue weather diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_python b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_python deleted file mode 100644 index 1340fe79eb..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_python +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON/pubsub - -topic_publisher_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Publisher -} - -background "Queues created" $py/topic_subscriber.py -clients topic_publisher_java -outputs ./topic_publisher_java.out "$py/topic_subscriber.py.out | remove_uuid | sort" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_python.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_python.in deleted file mode 100644 index 92184201d0..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_java_python.in +++ /dev/null @@ -1,95 +0,0 @@ -==== topic_publisher_java.out -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 -==== topic_subscriber.py.out | remove_uuid | sort -message 1 -message 1 -message 1 -message 1 -message 1 -message 1 -message 1 -message 1 -message 2 -message 2 -message 2 -message 2 -message 2 -message 2 -message 2 -message 2 -message 3 -message 3 -message 3 -message 3 -message 3 -message 3 -message 3 -message 3 -message 4 -message 4 -message 4 -message 4 -message 4 -message 4 -message 4 -message 4 -message 5 -message 5 -message 5 -message 5 -message 5 -message 5 -message 5 -message 5 -message 6 -message 6 -message 6 -message 6 -message 6 -message 6 -message 6 -message 6 -Messages on 'europe' queue: -Messages on 'news' queue: -Messages on 'usa' queue: -Messages on 'weather' queue: -Queues created - please start the topic producer -Subscribing local queue 'local_europe' to europe-' -Subscribing local queue 'local_news' to news-' -Subscribing local queue 'local_usa' to usa-' -Subscribing local queue 'local_weather' to weather-' -That's all, folks! -That's all, folks! -That's all, folks! -That's all, folks! diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_python_java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_python_java deleted file mode 100644 index b7fba2b3e0..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_python_java +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON/pubsub - -topic_listener_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Listener -} - -background "can receive messages" topic_listener_java -clients $py/topic_publisher.py -outputs $py/topic_publisher.py.out "topic_listener_java.out | remove_uuid | sort" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_python_java.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_python_java.in deleted file mode 100644 index 68b96cba2b..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/verify_python_java.in +++ /dev/null @@ -1,55 +0,0 @@ -==== topic_publisher.py.out -==== topic_listener_java.out | remove_uuid | sort -Listener: Closing connection -Listener: Closing JNDI context -Listener: Creating a Message Subscriber for topic europe -Listener: Creating a Message Subscriber for topic news -Listener: Creating a Message Subscriber for topic usa -Listener: Creating a Message Subscriber for topic weather -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Received message for topic: europe: europe.news 0 -Listener: Received message for topic: europe: europe.news 1 -Listener: Received message for topic: europe: europe.news 2 -Listener: Received message for topic: europe: europe.news 3 -Listener: Received message for topic: europe: europe.news 4 -Listener: Received message for topic: europe: europe.weather 0 -Listener: Received message for topic: europe: europe.weather 1 -Listener: Received message for topic: europe: europe.weather 2 -Listener: Received message for topic: europe: europe.weather 3 -Listener: Received message for topic: europe: europe.weather 4 -Listener: Received message for topic: news: europe.news 0 -Listener: Received message for topic: news: europe.news 1 -Listener: Received message for topic: news: europe.news 2 -Listener: Received message for topic: news: europe.news 3 -Listener: Received message for topic: news: europe.news 4 -Listener: Received message for topic: news: usa.news 0 -Listener: Received message for topic: news: usa.news 1 -Listener: Received message for topic: news: usa.news 2 -Listener: Received message for topic: news: usa.news 3 -Listener: Received message for topic: news: usa.news 4 -Listener: Received message for topic: usa: usa.news 0 -Listener: Received message for topic: usa: usa.news 1 -Listener: Received message for topic: usa: usa.news 2 -Listener: Received message for topic: usa: usa.news 3 -Listener: Received message for topic: usa: usa.news 4 -Listener: Received message for topic: usa: usa.weather 0 -Listener: Received message for topic: usa: usa.weather 1 -Listener: Received message for topic: usa: usa.weather 2 -Listener: Received message for topic: usa: usa.weather 3 -Listener: Received message for topic: usa: usa.weather 4 -Listener: Received message for topic: weather: europe.weather 0 -Listener: Received message for topic: weather: europe.weather 1 -Listener: Received message for topic: weather: europe.weather 2 -Listener: Received message for topic: weather: europe.weather 3 -Listener: Received message for topic: weather: europe.weather 4 -Listener: Received message for topic: weather: usa.weather 0 -Listener: Received message for topic: weather: usa.weather 1 -Listener: Received message for topic: weather: usa.weather 2 -Listener: Received message for topic: weather: usa.weather 3 -Listener: Received message for topic: weather: usa.weather 4 -Listener: Setting an ExceptionListener on the connection as sample uses a TopicSubscriber -Listener: Shutting down listener for europe -Listener: Shutting down listener for news -Listener: Shutting down listener for usa -Listener: Shutting down listener for weather -Listener: Starting connection so TopicSubscriber can receive messages diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/Client.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/Client.java deleted file mode 100644 index 0589a3801b..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/Client.java +++ /dev/null @@ -1,153 +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. - * - */ -package org.apache.qpid.example.jmsexample.requestResponse; - - -import javax.jms.*; -import javax.naming.Context; -import javax.naming.InitialContext; -import java.util.Properties; - -/** - * This example illustrates the use of the JMS utility class <code>QueueRequestor</code> - * which provides a synchronous RPC-like abstraction using temporary destinations - * to deliver responses back to the client. - */ -public class Client -{ - /* Used in log output. */ - private static final String CLASS="Client"; - - - /** - * Run the message requestor example. - * - * @param args Command line arguments. - */ - public static void main(String[] args) - { - Client requestor=new Client(); - requestor.runTest(); - } - - /** - * Start the example. - */ - private void runTest() - { - try - { - // Load JNDI properties - Properties properties=new Properties(); - properties.load(this.getClass().getResourceAsStream("requestResponse.properties")); - - //Create the initial context - Context ctx=new InitialContext(properties); - - // Lookup the connection factory - ConnectionFactory conFac = (ConnectionFactory) ctx.lookup("qpidConnectionfactory"); - - // create the connection - QueueConnection connection = (QueueConnection) conFac.createConnection(); - - // As this application is using a MessageConsumer we need to set an ExceptionListener on the connection - // so that errors raised within the JMS client library can be reported to the application - System.out.println( - CLASS + ": Setting an ExceptionListener on the connection as sample uses a MessageConsumer"); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException jmse) - { - // The connection may have broken invoke reconnect code if available. - // The connection may have broken invoke reconnect code if available. - System.err.println(CLASS + ": The sample received an exception through the ExceptionListener"); - System.exit(0); - } - }); - - // Create a session on the connection. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); - - // Lookup the destination - Queue destination = (Queue) ctx.lookup("requestQueue"); - - // Create a QueueRequestor - System.out.println(CLASS + ": Creating a QueueRequestor"); - - QueueRequestor requestor = new QueueRequestor(session, destination); - - // Now start the connection - System.out.println(CLASS + ": Starting connection"); - connection.start(); - - // Create a message to send as a request for service - TextMessage request; - - // Send some messages to the server's request queue - String[] messages = {"Twas brillig, and the slithy toves", - "Did gire and gymble in the wabe.", - "All mimsy were the borogroves,", - "And the mome raths outgrabe."}; - - // Get the number of times that this sample should request service - for (String message : messages) - { - request = session.createTextMessage(message); - sendReceive(request, requestor); - } - - // Close the connection to the server - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } - - private void sendReceive(TextMessage request, QueueRequestor requestor) throws JMSException - { - Message response; - response=requestor.request(request); - System.out.println(CLASS + ": \tRequest Content= " + request.getText()); - // Print out the details of the response received - String text; - if (response instanceof TextMessage) - { - text=((TextMessage) response).getText(); - } - else - { - byte[] body=new byte[(int) ((BytesMessage) response).getBodyLength()]; - ((BytesMessage) response).readBytes(body); - text=new String(body); - } - System.out.println(CLASS + ": \tResponse Content= " + text); - } -} - diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/Server.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/Server.java deleted file mode 100644 index 2ac349a879..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/Server.java +++ /dev/null @@ -1,163 +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. - * - */ -package org.apache.qpid.example.jmsexample.requestResponse; - -import javax.jms.*; -import javax.naming.Context; -import javax.naming.InitialContext; -import java.util.Properties; - -/** - * The example creates a MessageConsumer on the specified - * Destination which is used to synchronously consume messages. If a - * received message has a ReplyTo header then a new response message is sent - * to that specified destination. - */ -public class Server -{ - /* Used in log output. */ - private static final String CLASS="Server"; - - - /** - * Run the message mirror example. - * - * @param args Command line arguments. - */ - public static void main(String[] args) - { - Server server=new Server(); - server.runTest(); - } - - /** - * Start the example. - */ - private void runTest() - { - try - { - // Load JNDI properties - Properties properties=new Properties(); - properties.load(this.getClass().getResourceAsStream("requestResponse.properties")); - - //Create the initial context - Context ctx=new InitialContext(properties); - - // Lookup the connection factory - ConnectionFactory conFac=(ConnectionFactory) ctx.lookup("qpidConnectionfactory"); - - // create the connection - Connection connection=conFac.createConnection(); - - // As this application is using a MessageConsumer we need to set an ExceptionListener on the connection - // so that errors raised within the JMS client library can be reported to the application - System.out.println( - CLASS + ": Setting an ExceptionListener on the connection as sample uses a MessageConsumer"); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException jmse) - { - // The connection may have broken invoke reconnect code if available. - // The connection may have broken invoke reconnect code if available. - System.err.println(CLASS + ": The sample received an exception through the ExceptionListener"); - System.exit(0); - } - }); - - // Create a session on the connection - // This session is a default choice of non-transacted and uses - // the auto acknowledge feature of a session. - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - - Session session=connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Lookup the destination - Queue destination = (Queue) ctx.lookup("requestQueue"); - - - // Create a MessageConsumer - System.out.println(CLASS + ": Creating a MessageConsumer"); - MessageConsumer messageConsumer=session.createConsumer(destination); - - /** - * Create a MessageProducer - */ - System.out.println(CLASS + ": Creating a MessageProducer"); - MessageProducer messageProducer; - - // Now the messageConsumer is set up we can start the connection - System.out.println(CLASS + ": Starting connection so MessageConsumer can receive messages"); - connection.start(); - - // Cycle round until all the messages are consumed. - Message requestMessage; - TextMessage responseMessage; - boolean end=false; - while (!end) - { - System.out.println(CLASS + ": Receiving the message"); - - requestMessage=messageConsumer.receive(); - - String text; - if (requestMessage instanceof TextMessage) - { - text=((TextMessage) requestMessage).getText(); - } - else - { - byte[] body=new byte[(int) ((BytesMessage) requestMessage).getBodyLength()]; - ((BytesMessage) requestMessage).readBytes(body); - text=new String(body); - } - - // Now bounce the message if a ReplyTo header was set. - if (requestMessage.getJMSReplyTo() != null) - { - System.out.println(CLASS + ": Activating response queue listener"); - responseMessage=session.createTextMessage(); - - responseMessage.setText(text.toUpperCase()); - System.out.println(CLASS + ": \tResponse = " + responseMessage.getText()); - - messageProducer=session.createProducer(requestMessage.getJMSReplyTo()); - messageProducer.send(responseMessage); - } - System.out.println(); - } - - // Close the connection to the server - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - exp.printStackTrace(); - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/requestResponse.properties b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/requestResponse.properties deleted file mode 100644 index c467a4f123..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/requestResponse.properties +++ /dev/null @@ -1,27 +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. -# -java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory - -# register some connection factories -# connectionfactory.[jndiname] = [ConnectionURL] -connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' - -# register some queues in JNDI using the form -# queue.[jndiName] = [physicalName] -queue.requestQueue = request diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify deleted file mode 100644 index c6caa7239e..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/pub-sub - -client_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Client -} - -server_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Server -} - -background "can receive messages" server_java -clients client_java -kill %% -outputs "client_java.out | remove_uuid" "server_java.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify.in deleted file mode 100644 index f2c244dea6..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify.in +++ /dev/null @@ -1,38 +0,0 @@ -==== client_java.out | remove_uuid -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 -==== server_java.out | remove_uuid -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 -Server: Receiving the message -Server: Activating response queue listener -Server: Response = TWAS BRILLIG, AND THE SLITHY TOVES - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = DID GIRE AND GYMBLE IN THE WABE. - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = ALL MIMSY WERE THE BOROGROVES, - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = AND THE MOME RATHS OUTGRABE. - -Server: Receiving the message diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_cpp_java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_cpp_java deleted file mode 100644 index c0e788e373..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_cpp_java +++ /dev/null @@ -1,12 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/request-response - -client_java() -{ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Client -} - -background "Waiting" $cpp/server -clients client_java -kill %% -outputs "client_java.out | remove_uuid" "$cpp/server.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_cpp_java.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_cpp_java.in deleted file mode 100644 index 4b7e7e0741..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_cpp_java.in +++ /dev/null @@ -1,22 +0,0 @@ -==== client_java.out | remove_uuid -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 -==== server.out | remove_uuid -Activating request queue listener for: request -Waiting for requests -Request: Twas brillig, and the slithy toves (TempQueue) -Request: Did gire and gymble in the wabe. (TempQueue) -Request: All mimsy were the borogroves, (TempQueue) -Request: And the mome raths outgrabe. (TempQueue) diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_cpp b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_cpp deleted file mode 100644 index 14a8c28000..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_cpp +++ /dev/null @@ -1,12 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/request-response - -server_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Server -} - -background "can receive messages" server_java -clients $cpp/client -#ps -ao pid,cmd | awk '/qpid-client-<version>.jar/{ print $1 }' | xargs -r kill -kill %% -outputs "$cpp/client.out | remove_uuid" "server_java.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_cpp.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_cpp.in deleted file mode 100644 index 9cccf39393..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_cpp.in +++ /dev/null @@ -1,35 +0,0 @@ -==== 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. -Request: All mimsy were the borogroves, -Request: And the mome raths outgrabe. -Waiting for all responses to arrive ... -Response: TWAS BRILLIG, AND THE SLITHY TOVES -Response: DID GIRE AND GYMBLE IN THE WABE. -Response: ALL MIMSY WERE THE BOROGROVES, -Response: AND THE MOME RATHS OUTGRABE. -Shutting down listener for client -==== server_java.out | remove_uuid -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 -Server: Receiving the message -Server: Activating response queue listener -Server: Response = TWAS BRILLIG, AND THE SLITHY TOVES - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = DID GIRE AND GYMBLE IN THE WABE. - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = ALL MIMSY WERE THE BOROGROVES, - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = AND THE MOME RATHS OUTGRABE. - -Server: Receiving the message diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_python b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_python deleted file mode 100644 index 2d2ec2fc04..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_python +++ /dev/null @@ -1,11 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON/request-response - -server_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Server -} - -background "can receive messages" server_java -clients $py/client.py -kill %% -outputs "$py/client.py.out | remove_uuid" "server_java.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_python.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_python.in deleted file mode 100644 index bffe9d2842..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_java_python.in +++ /dev/null @@ -1,34 +0,0 @@ -==== client.py.out | remove_uuid -Request: Twas brillig, and the slithy toves -Request: Did gyre and gimble in the wabe. -Request: All mimsy were the borogroves, -Request: And the mome raths outgrabe. -Messages on queue: reply_to: -Response: TWAS BRILLIG, AND THE SLITHY TOVES -Response: DID GYRE AND GIMBLE IN THE WABE. -Response: ALL MIMSY WERE THE BOROGROVES, -Response: AND THE MOME RATHS OUTGRABE. -No more messages! -==== server_java.out | remove_uuid -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 -Server: Receiving the message -Server: Activating response queue listener -Server: Response = TWAS BRILLIG, AND THE SLITHY TOVES - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = DID GYRE AND GIMBLE IN THE WABE. - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = ALL MIMSY WERE THE BOROGROVES, - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = AND THE MOME RATHS OUTGRABE. - -Server: Receiving the message diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_python_java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_python_java deleted file mode 100644 index bcedf168e3..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_python_java +++ /dev/null @@ -1,11 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON/request-response - -client_java(){ -java -Dlog4j.configuration=$LOG4J -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Client -} - -background "Request server running" $py/server.py -clients client_java -kill %% -outputs "client_java.out | remove_uuid" "$py/server.py.out | remove_uuid" diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_python_java.in b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_python_java.in deleted file mode 100644 index 6e53ca3281..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/verify_python_java.in +++ /dev/null @@ -1,18 +0,0 @@ -==== client_java.out | remove_uuid -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 -==== server.py.out | remove_uuid -Request server running - run your client now. -(Times out after 100 seconds ...) diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/transacted/QueueToTopic.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/transacted/QueueToTopic.java deleted file mode 100644 index f3bf9f8686..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/transacted/QueueToTopic.java +++ /dev/null @@ -1,259 +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. - * - */ -package org.apache.qpid.example.jmsexample.transacted; - -import javax.jms.*; -import javax.naming.Context; -import javax.naming.InitialContext; -import java.util.Properties; - -/** - * Transactional message example sends a number of messages to a Queue - * and then uses a transacted session to move them from the Queue to a Topic. - * <p/> - * <p>The program completes the following steps: - * <ul> - * <li>Publish the specified number of messages to the queue.</li> - * <li>Within a transacted session consume all messages from the queue - * and publish them to the topic.</li> - * <li>By default commit the transacted session, unless the "<code>-rollback true</code>" - * option is specified in which case roll it back.</li> - * <li>Check for outstanding messages on the queue.</li> - * <li>Check for outstanding messages on the topic.</li> - * </ul> - * <p/> - */ -public class QueueToTopic -{ - /* Used in log output. */ - private static final String CLASS="QueueToTopic"; - - - /* Specify if the transaction is committed */ - private boolean _commit; - - /** - * Create a QueueToTopic client. - * - * @param commit Specifies if the transaction should be committed. - */ - public QueueToTopic(boolean commit) - { - _commit=commit; - } - - /** - * Run the message mover example. - * - * @param args Command line arguments. - */ - public static void main(String[] args) - { - boolean commit=true; - if (args.length > 1) - { - if (args[0].equalsIgnoreCase("-rollback")) - { - commit=!Boolean.getBoolean(args[1]); - } - } - QueueToTopic mover=new QueueToTopic(commit); - mover.runTest(); - } - - private void runTest() - { - try - { - // Load JNDI properties - Properties properties=new Properties(); - properties.load(this.getClass().getResourceAsStream("transacted.properties")); - - //Create the initial context - Context ctx=new InitialContext(properties); - - // Lookup the connection factory - ConnectionFactory conFac=(ConnectionFactory) ctx.lookup("qpidConnectionfactory"); - // create the connection - Connection connection=conFac.createConnection(); - - // As this application is using a MessageConsumer we need to set an ExceptionListener on the connection - // so that errors raised within the JMS client library can be reported to the application - System.out.println( - CLASS + ": Setting an ExceptionListener on the connection as sample uses a MessageConsumer"); - - connection.setExceptionListener(new ExceptionListener() - { - public void onException(JMSException jmse) - { - // The connection may have broken invoke reconnect code if available. - System.err.println(CLASS + ": The sample received an exception through the ExceptionListener"); - System.exit(0); - } - }); - - // Start the connection - connection.start(); - - /** - * Create nonTransactedSession. This non-transacted auto-ack session is used to create the MessageProducer - * that is used to populate the queue and the MessageConsumer that is used to consume the messages - * from the topic. - */ - System.out.println(CLASS + ": Creating a non-transacted, auto-acknowledged session"); - Session nonTransactedSession=connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Lookup the queue - Queue queue=(Queue) ctx.lookup("transactedQueue"); - - // Lookup the topic - Topic topic=(Topic) ctx.lookup("transactedTopic"); - - // Make sure that the queue is empty - System.out.print(CLASS + ": Purging messages from queue..."); - MessageConsumer queueMessageConsumer=nonTransactedSession.createConsumer(queue); - Message purgedMessage; - int numberPurged=-1; - do - { - purgedMessage=queueMessageConsumer.receiveNoWait(); - numberPurged++; - } - while (purgedMessage != null); - System.out.println(numberPurged + " message(s) purged."); - - // Create the MessageProducer for the queue - System.out.println(CLASS + ": Creating a MessageProducer for the queue"); - MessageProducer messageProducer=nonTransactedSession.createProducer(queue); - - // Now create the MessageConsumer for the topic - System.out.println(CLASS + ": Creating a MessageConsumer for the topic"); - MessageConsumer topicMessageConsumer=nonTransactedSession.createConsumer(topic); - - // Create a textMessage. We're using a TextMessage for this example. - System.out.println(CLASS + ": Creating a TestMessage to send to the destination"); - TextMessage textMessage=nonTransactedSession.createTextMessage("Sample text message"); - - // Loop to publish the requested number of messages to the queue. - for (int i=1; i <= 5; i++) - { - messageProducer - .send(textMessage, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, - Message.DEFAULT_TIME_TO_LIVE); - - // Print out details of textMessage just sent - System.out.println(CLASS + ": Message sent: " + i + " " + textMessage.getJMSMessageID()); - } - - // Create a new transacted Session to move the messages from the queue to the topic - Session transactedSession=connection.createSession(true, Session.SESSION_TRANSACTED); - - // Create a new message consumer from the queue - MessageConsumer transactedConsumer=transactedSession.createConsumer(queue); - - // Create a new message producer for the topic - MessageProducer transactedProducer=transactedSession.createProducer(topic); - - // Loop to consume the messages from the queue and publish them to the topic - Message receivedMessage; - for (int i=1; i <= 5; i++) - { - // Receive a message - receivedMessage=transactedConsumer.receive(); - System.out.println(CLASS + ": Moving message: " + i + " " + receivedMessage.getJMSMessageID()); - // Publish it to the topic - transactedProducer.send(receivedMessage); - } - - // Either commit or rollback the transacted session based on the command line args. - if (_commit) - { - System.out.println(CLASS + ": Committing transacted session."); - transactedSession.commit(); - } - else - { - System.out.println(CLASS + ": Rolling back transacted session."); - transactedSession.rollback(); - } - - // Now consume any outstanding messages on the queue - System.out.print(CLASS + ": Mopping up messages from queue"); - if (_commit) - { - System.out.print(" (expecting none)..."); - } - else - { - System.out.print(" (expecting " + 5 + ")..."); - } - - Message moppedMessage; - int numberMopped=0; - do - { - moppedMessage=queueMessageConsumer.receiveNoWait(); - if (moppedMessage != null) - { - numberMopped++; - } - } - while (moppedMessage != null); - System.out.println(numberMopped + " message(s) mopped."); - - // Now consume any outstanding messages for the topic subscriber - System.out.print(CLASS + ": Mopping up messages from topic"); - - if (_commit) - { - System.out.print(" (expecting " + 5 + ")..."); - } - else - { - System.out.print(" (expecting none)..."); - } - - numberMopped=0; - do - { - moppedMessage=topicMessageConsumer.receiveNoWait(); - if (moppedMessage != null) - { - numberMopped++; - } - } - while (moppedMessage != null); - System.out.println(numberMopped + " message(s) mopped."); - - // Close the QueueConnection to the server - System.out.println(CLASS + ": Closing connection"); - connection.close(); - - // Close the JNDI reference - System.out.println(CLASS + ": Closing JNDI context"); - ctx.close(); - } - catch (Exception exp) - { - System.err.println(CLASS + ": Caught an Exception: " + exp); - } - } -} diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/transacted/transacted.properties b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/transacted/transacted.properties deleted file mode 100644 index d93d19eea0..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/transacted/transacted.properties +++ /dev/null @@ -1,31 +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. -# -java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory - -# register some connection factories -# connectionfactory.[jndiname] = [ConnectionURL] -connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' - -# register some queues in JNDI using the form -# queue.[jndiName] = [physicalName] -queue.transactedQueue = transactedQueue - -# register some topics in JNDI using the form -# topic.[jndiName] = [physicalName] -topic.transactedTopic = transactedTopic
\ No newline at end of file |