activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwark <>
Subject VirtualTopic and persistency problem
Date Wed, 21 Nov 2007 14:20:41 GMT

I have a problem with VirtualTopics and persistency.

Consider the following setup:

I have a producer which produces messages to virtualtopic:
I have a manager with an embedded broker and two statically defined queues:
Consumer.module1.VirtualTopic.mytopic and
I have two consumers, one for each queue defined above

Now everything works fine as expected as long as the broker stays online:
producer produces messages and even when one of the consumers goes down, it
receives all produced messages as soon as it comes back online. Cool!

Consider now the following scenario:
1) I start the manager with embedded broker, I start the consumer for
module1 and the producer.
2) I let this run for a while and then I first stop the consumer and then
the producer. At this moment consumer for module1 has received all the
produced messages, but consumer for module2 was never started and did not
receive any of the produced messages. This can also be seen from inspection
of the queues through JMX: queue Consumer.module2.VirtualTopic.mytopic still
has x messages in its queue.
3) Now I stop and restart the manager (broker). During restart I see a
Warning message that the referenceStore is not valid and AMQ is recovering.
It also logs that it has recovered x operations from redo log.
4) I also start the consumer for module2, however it never receives the
messages produced before the broker restarted.

Is this known behaviour? Did I forget to do something special? 

Some more information. This was tested with both AMQ 4.1 and latest 5.0
snapshot. None of them produced the desired result. I use JMS transactions
and producer is set to produce persistent messages.

I did some debugging when the broker starts and the recovered messages from
the redo log are messages of the VirtualTopic.mytopic topic. These messages
are recovered and AMQ tries to add them to the reference store for that
topic, which is a KahaTopicReferenceStore. When I look at the implementation
of addMessageReference I see that it checks the subscriberCount of the topic
and only adds it to the store when this is > 0. If I check the
VirtualTopic.mytopic with JMX I can see that this is 0, so it never gets
added back to the topics reference store.

Can anyone provide some more insight on how to get persistency working
correctly with VirtualTopics?

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message