You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by joesan <co...@gmail.com> on 2012/08/21 14:48:31 UTC

ActiveMQ Master / Slave Message Integrity

I have a Master / Slave setup of two ActiveMQ Brokers on the same host and
has a shared network drive for persistence. According to the ActiveMQ
documentation, when the Master goes down the slave picks up and the clients
can still be connected without the messages being lost. But what I
experience is something different. When my Master went out, I manually shut
down my Consumer while my Producer is still sending messages. These messages
are picked up by the Slave. But later I restart my Consumer and to my
surprise, all those messages that were sent to the Slave during Consumer
downtime is not available once the Consumer was fired up. My question is do
I have to use a durable subscription topic? All my topics are non durable.
If I have to use a durable subscription topic, then can anyone please update
the documentation in the ActiveMQ Wiki pages where clustering is explained.



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Master-Slave-Message-Integrity-tp4655369.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

RE: ActiveMQ Master / Slave Message Integrity

Posted by "Tlholoe, Peter" <PT...@fnb.co.za>.
Have a look at the following, this method is in the javax.jms.Session class. 

public TopicSubscriber createDurableSubscriber(Topic topic,
                                               String name)
                                        throws JMSException


-----Original Message-----
From: joesan [mailto:codeintheopen@gmail.com] 
Sent: 21 August 2012 07:53 PM
To: users@activemq.apache.org
Subject: Re: ActiveMQ Master / Slave Message Integrity

Can you show me some pointers on how to use a durable consumer? 



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Master-Slave-Message-Integrity-tp4655369p4655391.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclaimer@fnb.co.za and we will send you a copy of the Disclaimer.

Re: ActiveMQ Master / Slave Message Integrity

Posted by joesan <co...@gmail.com>.
Can you show me some pointers on how to use a durable consumer? 



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Master-Slave-Message-Integrity-tp4655369p4655391.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ Master / Slave Message Integrity

Posted by Timothy Bish <ta...@gmail.com>.
On Tue, 2012-08-21 at 08:22 -0700, joesan wrote: 
> I just performed the following test on my Master / Slave:
> 
> Started AMQ1 and AMQ2 - Both runs on the same host but with a different port
> 
> Started my Consumer and Producer - Both have the fail-over protocol to
> connect to the AMQ
> 
> I send messages using my producer in a loop... where with every 10 seconds
> gap 10 messages are sent
> 
> Checking the log files of the Consumer, I can confirm that the Consumer is
> receiving the messages
> 
> I open the admin console and I could see the Messages En-queued and Messages
> De-queued are 80 and 70 respectively
> 
> Now I shutdown my AMQ1. The AMQ2 picks up the lock from the shared file
> system. Now the actual problem starts:
> 
> (1) When the AMQ2 is fully started, I open the admin console and under
> Topics, I see the Messages En-queued and Messages De-queued to be 0. What
> happened to the remaining 10 messages that were pending to be De-queued? I
> used a durable producer.

You need to create a durable consumer, a plain consumer on a topic won't
receive any messages that were produced while it was offline.  

> 
> (2) I do not understand why my Consumer shuts down and does not fail over at
> all
> 
> (3) When I do this shutdown startup a couple of times between AMQ1 and AMQ2,
> I find that the process to acquire the lock by the standby takes a longer
> time with each iteration and after the third try, even my Producer shuts
> down.
> 
> I would appreciate if anyone can throw some light on my problems.
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Master-Slave-Message-Integrity-tp4655369p4655385.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

-- 
Tim Bish
Sr Software Engineer | FuseSource Corp
tim.bish@fusesource.com | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: ActiveMQ Master / Slave Message Integrity

Posted by joesan <co...@gmail.com>.
I just performed the following test on my Master / Slave:

Started AMQ1 and AMQ2 - Both runs on the same host but with a different port

Started my Consumer and Producer - Both have the fail-over protocol to
connect to the AMQ

I send messages using my producer in a loop... where with every 10 seconds
gap 10 messages are sent

Checking the log files of the Consumer, I can confirm that the Consumer is
receiving the messages

I open the admin console and I could see the Messages En-queued and Messages
De-queued are 80 and 70 respectively

Now I shutdown my AMQ1. The AMQ2 picks up the lock from the shared file
system. Now the actual problem starts:

(1) When the AMQ2 is fully started, I open the admin console and under
Topics, I see the Messages En-queued and Messages De-queued to be 0. What
happened to the remaining 10 messages that were pending to be De-queued? I
used a durable producer.

(2) I do not understand why my Consumer shuts down and does not fail over at
all

(3) When I do this shutdown startup a couple of times between AMQ1 and AMQ2,
I find that the process to acquire the lock by the standby takes a longer
time with each iteration and after the third try, even my Producer shuts
down.

I would appreciate if anyone can throw some light on my problems.



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Master-Slave-Message-Integrity-tp4655369p4655385.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ Master / Slave Message Integrity

Posted by joesan <co...@gmail.com>.
Thanks for the info. So all I have to do is just to durable subscribe my
Producer. On the Consumer side, I do not have to specify durable
subscription?



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Master-Slave-Message-Integrity-tp4655369p4655381.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ Master / Slave Message Integrity

Posted by Torsten Mielke <to...@fusesource.com>.
Answers in-line.

On Aug 21, 2012, at 2:48 PM, joesan wrote:

> I have a Master / Slave setup of two ActiveMQ Brokers on the same host and
> has a shared network drive for persistence. According to the ActiveMQ
> documentation, when the Master goes down the slave picks up and the clients
> can still be connected without the messages being lost. But what I
> experience is something different. When my Master went out, I manually shut
> down my Consumer while my Producer is still sending messages. These messages
> are picked up by the Slave. But later I restart my Consumer and to my
> surprise, all those messages that were sent to the Slave during Consumer
> downtime is not available once the Consumer was fired up. My question is do
> I have to use a durable subscription topic? All my topics are non durable.
> If I have to use a durable subscription topic, then can anyone please update
> the documentation in the ActiveMQ Wiki pages where clustering is explained.

If your producer sends messages to a topic and not to a queue, then the broker discards these messages if there is no subscriber connected. You will need to use durable topic subscriptions if you want the broker to store these messages.
Things are different with queue messages. They are kept by the broker by default when there are no consumers connected.

Best Regards,

Torsten Mielke
torsten@fusesource.com
tmielke@blogspot.com