From ca8e0ae1c7f635eff690561d6c4dc5cc6ec62fb2 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 18 Jan 2008 09:29:26 +0000 Subject: Qpid 742 git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@613114 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/example/jmsexample/pubsub/Listener.java | 27 +++++++------ .../main/java/org/apache/qpid/example/log4j.xml | 45 ---------------------- .../org/apache/qpid/client/AMQTopicSubscriber.java | 11 ------ .../apache/qpid/client/TopicSubscriberAdaptor.java | 4 +- .../java/org/apache/qpid/jms/TopicSubscriber.java | 11 ++++++ .../org/apache/qpid/testutil/QpidTestCase.java | 5 +++ 6 files changed, 31 insertions(+), 72 deletions(-) delete mode 100644 java/client/example/src/main/java/org/apache/qpid/example/log4j.xml delete mode 100644 java/client/src/main/java/org/apache/qpid/client/AMQTopicSubscriber.java create mode 100644 java/client/src/main/java/org/apache/qpid/jms/TopicSubscriber.java (limited to 'java') 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 index 196f7c8245..8098f62be9 100644 --- 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 @@ -17,19 +17,18 @@ */ package org.apache.qpid.example.jmsexample.pubsub; -import org.apache.qpid.client.AMQSession; -import org.apache.qpid.client.BasicMessageConsumer; -import org.apache.qpid.client.AMQDestination; -import org.apache.qpid.client.AMQTopicSubscriber; +import org.apache.qpid.jms.TopicSubscriber; import javax.jms.*; +import javax.jms.Session; +import javax.jms.Message; import javax.naming.Context; import javax.naming.InitialContext; import java.util.Properties; /** - * The example creates a MessageConsumer on the specified - * Topic and uses a MessageListener with this MessageConsumer + * 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 @@ -74,10 +73,10 @@ public class Listener ConnectionFactory conFac=(ConnectionFactory) ctx.lookup("qpidConnectionfactory"); TopicConnection connection=(TopicConnection) conFac.createConnection(); - // As this application is using a MessageConsumer we need to set an ExceptionListener on the connection + // 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 MessageConsumer"); + CLASS + ": Setting an ExceptionListener on the connection as sample uses a TopicSubscriber"); connection.setExceptionListener(new ExceptionListener() { @@ -99,11 +98,11 @@ public class Listener Topic topic=(Topic) ctx.lookup("usa"); // Create a Message Subscriber System.out.println(CLASS + ": Creating a Message Subscriber for topic usa.#"); - TopicSubscriber messageSubscriber=session.createSubscriber(topic); + javax.jms.TopicSubscriber messageSubscriber=session.createSubscriber(topic); // Bind each topic queue to the control queue so we know when to stop // Warning: this is an AMQP specific code - ((AMQTopicSubscriber) messageSubscriber).addBindingKey( topic, "control"); + ((TopicSubscriber) messageSubscriber).addBindingKey( topic, "control"); // Set a message listener on the messageConsumer messageSubscriber.setMessageListener(new MyMessageListener("usa")); @@ -116,7 +115,7 @@ public class Listener // Bind each topic queue to the control queue so we know when to stop // Warning: this is an AMQP specific code - ((AMQTopicSubscriber) messageSubscriber).addBindingKey( topic, "control"); + ((org.apache.qpid.jms.TopicSubscriber) messageSubscriber).addBindingKey( topic, "control"); // Set a message listener on the messageConsumer messageSubscriber.setMessageListener(new MyMessageListener("europe")); @@ -129,7 +128,7 @@ public class Listener // Bind each topic queue to the control queue so we know when to stop // Warning: this is an AMQP specific code - ((AMQTopicSubscriber) messageSubscriber).addBindingKey( topic, "control"); + ((org.apache.qpid.jms.TopicSubscriber) messageSubscriber).addBindingKey( topic, "control"); // Set a message listener on the messageConsumer messageSubscriber.setMessageListener(new MyMessageListener("news")); @@ -142,13 +141,13 @@ public class Listener // Bind each topic queue to the control queue so we know when to stop // Warning: this is an AMQP specific code - ((AMQTopicSubscriber) messageSubscriber).addBindingKey( topic, "control"); + ((org.apache.qpid.jms.TopicSubscriber) messageSubscriber).addBindingKey( topic, "control"); // Set a message listener on the messageConsumer messageSubscriber.setMessageListener(new MyMessageListener("weather")); // Now the messageConsumer is set up we can start the connection - System.out.println(CLASS + ": Starting connection so MessageConsumer can receive messages"); + 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 diff --git a/java/client/example/src/main/java/org/apache/qpid/example/log4j.xml b/java/client/example/src/main/java/org/apache/qpid/example/log4j.xml deleted file mode 100644 index 3465e75611..0000000000 --- a/java/client/example/src/main/java/org/apache/qpid/example/log4j.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQTopicSubscriber.java b/java/client/src/main/java/org/apache/qpid/client/AMQTopicSubscriber.java deleted file mode 100644 index 97e2898de4..0000000000 --- a/java/client/src/main/java/org/apache/qpid/client/AMQTopicSubscriber.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.apache.qpid.client; - -import org.apache.qpid.AMQException; - -import javax.jms.Topic; - -public interface AMQTopicSubscriber -{ - - void addBindingKey(Topic topic, String bindingKey) throws AMQException; -} diff --git a/java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java b/java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java index 507490d6fb..dd8ca8e197 100644 --- a/java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java +++ b/java/client/src/main/java/org/apache/qpid/client/TopicSubscriberAdaptor.java @@ -21,18 +21,18 @@ package org.apache.qpid.client; import org.apache.qpid.AMQException; +import org.apache.qpid.jms.TopicSubscriber; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.Topic; -import javax.jms.TopicSubscriber; /** * Wraps a MessageConsumer to fulfill the extended TopicSubscriber contract * */ -class TopicSubscriberAdaptor implements TopicSubscriber, AMQTopicSubscriber +class TopicSubscriberAdaptor implements org.apache.qpid.jms.TopicSubscriber { private final Topic _topic; private final BasicMessageConsumer _consumer; diff --git a/java/client/src/main/java/org/apache/qpid/jms/TopicSubscriber.java b/java/client/src/main/java/org/apache/qpid/jms/TopicSubscriber.java new file mode 100644 index 0000000000..80cfa18ec1 --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/jms/TopicSubscriber.java @@ -0,0 +1,11 @@ +package org.apache.qpid.jms; + +import org.apache.qpid.AMQException; + +import javax.jms.Topic; + +public interface TopicSubscriber extends javax.jms.TopicSubscriber +{ + + void addBindingKey(Topic topic, String bindingKey) throws AMQException; +} diff --git a/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java b/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java index 094790fb7e..8ab381db32 100644 --- a/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java +++ b/java/client/src/test/java/org/apache/qpid/testutil/QpidTestCase.java @@ -253,4 +253,9 @@ public class QpidTestCase extends TestCase } return con; } + + public void testfoo() + { + //do nothing, just to avoid maven to report an error + } } -- cgit v1.2.1