You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "SuoNayi Wang (JIRA)" <ji...@apache.org> on 2010/01/08 07:00:16 UTC

[jira] Created: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

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


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,
	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="connectionFactory"/>
		<property name="sessionTransacted" value="true"/>
		<property name="pubSubDomain" value="true"/>
		<property name="pubSubNoLocal" value="true"/>
		<property name="destination" ref="topicDestination"/>
		<property name="subscriptionDurable" value="true"/>
		<property name="durableSubscriptionName" value="bus.topic"/>
		<property name="messageListener">
			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
		</property>

	</bean>
4, messageListener receive messages sent by itself.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56951#action_56951 ] 

SuoNayi Wang edited comment on AMQ-2561 at 1/16/10 11:11 AM:
-------------------------------------------------------------

Thanks Davies,I have figured out what happened.
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber does not receive message sent by the same connection.
I restart Producer.java again. Subscriber  receive message sent by itself last time.
So it seems I have made a mistake.
:)


      was (Author: wangyin):
    Thanks Davies,I have figured out what happened.
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber do not receive message sent by the same connection.
I restart Producer.java again. Subscriber  receive message sent by itself last time.
So it seems I have made a mistake.
:)

  
> 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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Updated: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "Bruce Snyder (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bruce Snyder updated AMQ-2561:
------------------------------

    Fix Version/s: 5.5.0
                       (was: 5.4.1)

> 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.5.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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Assigned: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies reassigned AMQ-2561:
-------------------------------

    Assignee: Rob Davies

> 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
>         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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Issue Comment Edited: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56951#action_56951 ] 

SuoNayi Wang edited comment on AMQ-2561 at 1/16/10 2:08 PM:
------------------------------------------------------------

Thanks Davies!
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber does not receive message sent by the same connection.
The information displayed in the console:
----------------------------------------------------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-5000-1263649149250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649150000, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}
-----------------------------------------------------------------------------------------------------------------------------------------------------------
I restart Producer.java again. Subscriber does receive message sent by itself this time.
The information displayed in the console:
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}

Receive a message ActiveMQTextMessage {commandId = 6, responseRequired = true, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 1263649053526, brokerOutTime = 1263649053531, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = THIS IS A TEST}
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Please notice that messageId  is same with the message sent to broker and received by messagelistener.


      was (Author: wangyin):
    Thanks Davies!
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber does not receive message sent by the same connection.
The information displayed in the console:
---------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-5000-1263649149250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649150000, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}
---------------------------------------------------------------------------------------------------------------
I restart Producer.java again. Subscriber does receive message sent by itself this time.
The information displayed in the console:
---------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}

Receive a message ActiveMQTextMessage {commandId = 6, responseRequired = true, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 1263649053526, brokerOutTime = 1263649053531, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = THIS IS A TEST}
---------------------------------------------------------------------------------------------------------------
Please notice that messageId  is same with the message sent to broker and received by messagelistener.

  
> 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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Updated: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

SuoNayi Wang updated AMQ-2561:
------------------------------

    Attachment: Producer.java

> 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
>         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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Resolved: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies resolved AMQ-2561.
-----------------------------

       Resolution: Fixed
    Fix Version/s: 5.4.0

Added test case - org.apache.activemq.bugs.JMSDurableTopicNoLocalTest - SVN revision 899205
Cannot reproduce on 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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Issue Comment Edited: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56951#action_56951 ] 

SuoNayi Wang edited comment on AMQ-2561 at 1/16/10 1:46 PM:
------------------------------------------------------------

Thanks Davies!
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber does not receive message sent by the same connection.
The information displayed in the console:
---------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-5000-1263649149250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649150000, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}
---------------------------------------------------------------------------------------------------------------
I restart Producer.java again. Subscriber does receive message sent by itself this time.
The information displayed in the console:
---------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}

Receive a message ActiveMQTextMessage {commandId = 6, responseRequired = true, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 1263649053526, brokerOutTime = 1263649053531, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = THIS IS A TEST}
---------------------------------------------------------------------------------------------------------------
Please notice that messageId  is the same with the message sent to broker and received by messagelistener.


      was (Author: wangyin):
    Thanks Davies,I have figured out what happened.
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber does not receive message sent by the same connection.
I restart Producer.java again. Subscriber  receive message sent by itself last time.
So it seems I have made a mistake.
:)

  
> 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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Commented: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57051#action_57051 ] 

Rob Davies commented on AMQ-2561:
---------------------------------

You can always provide a patch :)

> 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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Updated: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hadrian Zbarcea updated AMQ-2561:
---------------------------------

    Fix Version/s: 5.4.1
                       (was: 5.4.0)

> 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.1
>
>         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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Commented: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Reopened: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

SuoNayi Wang reopened AMQ-2561:
-------------------------------

    Regression: [Regression]

> 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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Commented: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56951#action_56951 ] 

SuoNayi Wang commented on AMQ-2561:
-----------------------------------

Thanks Davies,I have figured out what happened.
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber do not receive message sent by the same connection.
I restart Producer.java again. Subscriber  receive message sent by itself last time.
So it seems I have made a mistake.
:)


> 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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Updated: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

SuoNayi Wang updated AMQ-2561:
------------------------------

    Description: 
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,
	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="connectionFactory"/>
		<property name="sessionTransacted" value="true"/>
		<property name="pubSubDomain" value="true"/>
		<property name="pubSubNoLocal" value="true"/>
		<property name="destination" ref="topicDestination"/>
		<property name="subscriptionDurable" value="true"/>
		<property name="durableSubscriptionName" value="bus.topic"/>
		<property name="messageListener">
			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
		</property>

	</bean>
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);
	}
}




  was:
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,
	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="connectionFactory" ref="connectionFactory"/>
		<property name="sessionTransacted" value="true"/>
		<property name="pubSubDomain" value="true"/>
		<property name="pubSubNoLocal" value="true"/>
		<property name="destination" ref="topicDestination"/>
		<property name="subscriptionDurable" value="true"/>
		<property name="durableSubscriptionName" value="bus.topic"/>
		<property name="messageListener">
			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
		</property>

	</bean>
4, messageListener receive messages sent by itself.



> 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
>         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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.


[jira] Issue Comment Edited: (AMQ-2561) Subscriber receives messages that sent by itself even if noLocal is true.

Posted by "SuoNayi Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56951#action_56951 ] 

SuoNayi Wang edited comment on AMQ-2561 at 1/16/10 1:48 PM:
------------------------------------------------------------

Thanks Davies!
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber does not receive message sent by the same connection.
The information displayed in the console:
---------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-5000-1263649149250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649150000, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}
---------------------------------------------------------------------------------------------------------------
I restart Producer.java again. Subscriber does receive message sent by itself this time.
The information displayed in the console:
---------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}

Receive a message ActiveMQTextMessage {commandId = 6, responseRequired = true, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 1263649053526, brokerOutTime = 1263649053531, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = THIS IS A TEST}
---------------------------------------------------------------------------------------------------------------
Please notice that messageId  is same with the message sent to broker and received by messagelistener.


      was (Author: wangyin):
    Thanks Davies!
To reproduce, I deploy a completely new AMQ 5.2.0 application on server  and drop all tables created by AMQ automatically.
then I start AMQ  and run the test case Producer.java.
It works fine. Subscriber does not receive message sent by the same connection.
The information displayed in the console:
---------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-5000-1263649149250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649150000, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}
---------------------------------------------------------------------------------------------------------------
I restart Producer.java again. Subscriber does receive message sent by itself this time.
The information displayed in the console:
---------------------------------------------------------------------------------------------------------------
Send a message ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = null, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = THIS IS A TEST}

Receive a message ActiveMQTextMessage {commandId = 6, responseRequired = true, messageId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:suonayi-826da47-1046-1263649222250-0:0:1:1, destination = topic://topicA, transactionId = null, expiration = 0, timestamp = 1263649223250, arrival = 0, brokerInTime = 1263649053526, brokerOutTime = 1263649053531, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, text = THIS IS A TEST}
---------------------------------------------------------------------------------------------------------------
Please notice that messageId  is the same with the message sent to broker and received by messagelistener.

  
> 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,
> 	<bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
> 		<property name="connectionFactory" ref="connectionFactory"/>
> 		<property name="sessionTransacted" value="true"/>
> 		<property name="pubSubDomain" value="true"/>
> 		<property name="pubSubNoLocal" value="true"/>
> 		<property name="destination" ref="topicDestination"/>
> 		<property name="subscriptionDurable" value="true"/>
> 		<property name="durableSubscriptionName" value="bus.topic"/>
> 		<property name="messageListener">
> 			<bean class="com.sinosoft.activemq.listener.DefaultMessageListener"/>
> 		</property>
> 	</bean>
> 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.