activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From HarveyCn <>
Subject Re: Does The ActiveMQ treat the same clientID consumer on different broker as different consumer?
Date Mon, 29 Jun 2009 18:41:21 GMT

Pre-configuration to set up network:
broker A      localhost:61616 activemq_61616.xml 
broker B      localhost:51616 activemq_51616.xml 
For localhost:61616 I change the networkConnector in activemq.xml from
<networkConnector name="default-nc" uri="multicast://default"/>
<networkConnector name="61616" uri="static://(tcp://localhost:51616)"/>
and for transportConnector from 
<transportConnector name="openwire" uri="tcp://localhost:61616"
<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.

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
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:
Sent from the ActiveMQ - User mailing list archive at

View raw message