Receiving old messages on durable topics after application restart using ActiveMQ two node cluster

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Receiving old messages on durable topics after application restart using ActiveMQ two node cluster

Stefan Verhoeff
Hello,

We are running a two node cluster of ActiveMQ 5.2. Our application uses durable persistent topics, it is both the producer and consumer of the messages. The application is configured using the failover:// protocol to work with the cluster nodes. The JMS client uses Spring for configuration, it's done as described here:
http://stefanlearninglog.blogspot.com/2009/07/persistent-jms-topics-using-activemq.html

It all runs fine. But when the application is restarted we start receiving old messages that have been consumed in the past. The age of the messages seems to correspond to the time of the last restart (for example: 20 days). We suspect the cluster nodes are replicating and storing the messages correctly but the node that the app is using is not marking the messages as 'consumed' on the other node. When on restart the other node is chosen it starts sending all messages that were consumed the last run on the other node. Is there anything we might have missed in configuration?

Kind regards,
Stefan
Reply | Threaded
Open this post in threaded view
|

Re: Receiving old messages on durable topics after application restart using ActiveMQ two node cluster

gtully
Can you share your configuration to show the cluster setup and
destination policies?
Off hand I can't think of any misconfiguration that would behave like this.
Can you reproduce with a short up time?


2009/11/6 Stefan Verhoeff <[hidden email]>:

>
> Hello,
>
> We are running a two node cluster of ActiveMQ 5.2. Our application uses
> durable persistent topics, it is both the producer and consumer of the
> messages. The application is configured using the failover:// protocol to
> work with the cluster nodes. The JMS client uses Spring for configuration,
> it's done as described here:
> http://stefanlearninglog.blogspot.com/2009/07/persistent-jms-topics-using-activemq.html
>
> It all runs fine. But when the application is restarted we start receiving
> old messages that have been consumed in the past. The age of the messages
> seems to correspond to the time of the last restart (for example: 20 days).
> We suspect the cluster nodes are replicating and storing the messages
> correctly but the node that the app is using is not marking the messages as
> 'consumed' on the other node. When on restart the other node is chosen it
> starts sending all messages that were consumed the last run on the other
> node. Is there anything we might have missed in configuration?
>
> Kind regards,
> Stefan
> --
> View this message in context: http://old.nabble.com/Receiving-old-messages-on-durable-topics-after-application-restart-using-ActiveMQ-two-node-cluster-tp26230816p26230816.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



--
http://blog.garytully.com

Open Source Integration
http://fusesource.com
Reply | Threaded
Open this post in threaded view
|

Re: Receiving old messages on durable topics after application restart using ActiveMQ two node cluster

joe_fernandez
In reply to this post by Stefan Verhoeff
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Receiving old messages on durable topics after application restart using ActiveMQ two node cluster

Stefan Verhoeff
To work around the problem we decided to re-architect to use Queues instead of Topics (since this application is the only one using Topics). The Virtual Destinations page does look promising to provide a solution, thanks for the advice.

Regards,
Stefan

Joe Fernandez wrote
I have noticed the same thing. If your failover connector includes the two nodes, then it is likely that your application - as a result of restarts - has pollinated both brokers with the same durable subscription. However, within the context of the network of brokers, they are viewed as different durable subscriptions for the same topic? I tried setting 'dynamicOnly' to 'true', but that did not make a difference.  You can cut down on the liklihood of pollinating both brokers by setting 'randomize' to 'false'. This would force your consumer to always connect to the first broker on the list. Another option is to use 'virtual topics' in combination with 'dynamicOnly' being set to 'true'.

http://activemq.apache.org/virtual-destinations.html

Joe
http://www.ttmsolutions.com