diff options
| author | Arnaud Simon <arnaudsimon@apache.org> | 2008-01-18 09:29:26 +0000 |
|---|---|---|
| committer | Arnaud Simon <arnaudsimon@apache.org> | 2008-01-18 09:29:26 +0000 |
| commit | ca8e0ae1c7f635eff690561d6c4dc5cc6ec62fb2 (patch) | |
| tree | 790136c21fe58eef1f3b5b478d2dcbeb24634cff /java/client/example/src | |
| parent | ad08b5c6eb216e5f35a10df25220687c51b1de77 (diff) | |
| download | qpid-python-ca8e0ae1c7f635eff690561d6c4dc5cc6ec62fb2.tar.gz | |
Qpid 742
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@613114 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/example/src')
| -rw-r--r-- | java/client/example/src/main/java/org/apache/qpid/example/jmsexample/pubsub/Listener.java | 27 | ||||
| -rw-r--r-- | java/client/example/src/main/java/org/apache/qpid/example/log4j.xml | 45 |
2 files changed, 13 insertions, 59 deletions
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 @@ -<?xml version="1.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. - - - --> -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="FileAppender" class="org.apache.log4j.FileAppender"> - <param name="File" value="ams_messaging.log"/> - <param name="Append" value="false"/> - - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/> - </layout> - </appender> - - <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> - - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/> - </layout> - </appender> - - <root> - <priority value="info"/> - <appender-ref ref="STDOUT"/> - <appender-ref ref="FileAppender"/> - </root> -</log4j:configuration>
\ No newline at end of file |
