Pre-configuration to set up network:
broker A      localhost:61616      
http://www.nabble.com/file/p24259347/activemq_61616.xml activemq_61616.xml 
broker B      localhost:51616      
http://www.nabble.com/file/p24259347/activemq_51616.xml activemq_51616.xml 
For localhost:61616 I change the networkConnector in activemq.xml from
<networkConnector name="default-nc" uri="multicast://default"/>
to
<networkConnector name="61616" uri="static://(tcp://localhost:51616)"/>
and for transportConnector from 
<transportConnector name="openwire" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
to 
<transportConnector name="openwire" uri="tcp://localhost:61616" />

Also changed for localhost:51616 and alter the port from 61616 to 51616 and
others to perish conflict.

Steps:
1. Start the broker A and broker B
2. Open a command window and execute 'ant consumer
-Durl="tcp://localhost:61616" -Dtopic=true -Dsubject="TOPIC.TEST"
-Ddurable=true -Dmax=1'
2. Another command window with 'ant producer
-Durl="failover:(tcp://localhost:51616,tcp://localhost:61616)" -Dtopic=true
-Dsubject="TOPIC.TEST" -Ddurable=true -Dmax=1'. We receive the message. the
client1 has registered.
3. Re-execute the command on step 2 to send messgae again.
4. Now switch to localhost:51616 to listen 'ant consumer
-Durl="tcp://localhost:51616" -Dtopic=true -Dsubject="TOPIC.TEST"
-Ddurable=true -Dmax=1'. Unfortunately we can't receive.
5. Send message with the previous send command. the listener on port 51616
received. 
6. Switch back to 61616 'ant consumer -Durl="tcp://localhost:61616"
-Dtopic=true -Dsubject="TOPIC.TEST" -Ddurable=true -Dmax=1'. We received the
message sent on step 3.
7. Listen again on 61616 received the message sent on step 5. Then we
received twice.


HarveyCn wrote:
> 
> Broker A and broker B build up a network of brokers. 
> Assuming in this case a client registered on broker A with clientID
> "client1" and somehow he lost the connection, at that time some messages
> came, next time when the "client1" resume the connection on broker B, he
> supposed to receive the messages when he is not here, right? But I failed
> on this case. The "client1" can't receive the messages until he re-connect
> to broker A. Actually on broker A he would receive the messages which he
> has received in brokers B again. 
> Base on that I draw a conclusion that The ActiveMQ treat the same clientID
> consumer on different broker as different consumer. But if the broker A
> broken, never came back, we would lost some messages. Is it possible that
> we recover the messages? I knew master/slave but can we build up a network
> with two master/slave pairs and how?
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Does-The-ActiveMQ-treat-the-same-clientID-consumer-on-different-broker-as-different-consumer--tp24259343p24259347.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to