Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 11981 invoked from network); 20 Jan 2010 05:25:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Jan 2010 05:25:29 -0000 Received: (qmail 27171 invoked by uid 500); 20 Jan 2010 05:25:28 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 27081 invoked by uid 500); 20 Jan 2010 05:25:28 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 27067 invoked by uid 99); 20 Jan 2010 05:25:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2010 05:25:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2010 05:25:25 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 33862234C4A8 for ; Tue, 19 Jan 2010 21:25:04 -0800 (PST) Message-ID: <600813832.6411263965104209.JavaMail.jira@brutus.apache.org> Date: Wed, 20 Jan 2010 05:25:04 +0000 (UTC) From: "SuoNayi Wang (JIRA)" To: dev@activemq.apache.org Subject: [jira] Commented: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true. In-Reply-To: <1512246485.4221262930416179.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57007#action_57007 ] SuoNayi Wang commented on AMQ-2561: ----------------------------------- I hava figured out what is incorrect in AMQ Broker. When a new subscriber comes Broker will create a new one and initialize it's selector. But when an existing subscriber comes Broker will just active it and do not initialize it's selector again. So the bug occurs. I hava fixed it but I'm not able to commit it to trunk. :) > Subscriber receives messages that sent by itself even if noLocal is true. > ------------------------------------------------------------------------- > > Key: AMQ-2561 > URL: https://issues.apache.org/activemq/browse/AMQ-2561 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.2.0 > Reporter: SuoNayi Wang > Assignee: Rob Davies > Fix For: 5.4.0 > > Attachments: Producer.java > > > 1, use org.springframework.jms.connection.SingleConnectionFactory to wrap org.apache.activemq.spring.ActiveMQConnectionFactory so that we only use single connection. > 2, use org.springframework.jms.core.JmsTemplate to send a simple text message. > 3, use org.springframework.jms.listener.DefaultMessageListenerContainer to receive message, > > > > > > > > > > > > > 4, messageListener receive messages sent by itself. > Also,to reproduce: > package test; > import javax.jms.Connection; > import javax.jms.ConnectionFactory; > import javax.jms.Message; > import javax.jms.MessageListener; > import javax.jms.MessageProducer; > import javax.jms.Session; > import javax.jms.TextMessage; > import javax.jms.Topic; > import javax.jms.TopicSubscriber; > import org.apache.activemq.ActiveMQConnectionFactory; > import org.apache.activemq.command.ActiveMQTopic; > public final class Producer implements MessageListener{ > private Producer() { > } > public static void main(String[] args) { > String url = "failover:(tcp://172.31.0.82:61610)"; > ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); > Topic destination = new ActiveMQTopic("bus.topic"); > > Connection connection = null; > try{ > connection = connectionFactory.createConnection(); > connection.setClientID("112234"); > > Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); > > TopicSubscriber subscriber = session.createDurableSubscriber(destination, "topicUser2", null, true); > System.out.println(subscriber + " getNoLocal()= " + subscriber.getNoLocal()); > Producer listener = new Producer(); > subscriber.setMessageListener(listener); > > connection.start(); > > MessageProducer producer = session.createProducer(destination); > TextMessage message = session.createTextMessage("THIS IS A TEST"); > producer.send(message); > producer.close(); > System.out.println("Send a message " + message); > }catch(Exception e){ > e.printStackTrace(); > } > } > public void onMessage(Message msg){ > System.out.println("Receive a message " + msg); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.