Can topic messages be made persistent in activemq?
Asked Answered
N

2

5

I am very new to JMS and ESB. I am using activemq as JMS and mule as ESB. When i am forwarding the messages from one queue to another with jms connector parameter "persistentDelivery" as "true" it retains the messages in the target queue after activemq re-start. But in case of forwarding messages from one topic to another,the messages are not retained in the target topic after restart.

Is there any limitation for persistence of messages in case of topic in activemq?

Thanks in advance.

Regards, Arijit

Nougat answered 11/1, 2012 at 19:9 Comment(0)
T
7

topics are different in that messages are only retained if there is a durable consumer.

see these for more info...

http://activemq.apache.org/how-do-durable-queues-and-topics-work.html

http://stefanlearninglog.blogspot.com/2009/07/persistent-jms-topics-using-activemq.html

Teresitateressa answered 28/2, 2012 at 16:13 Comment(0)
O
0

Topics in Activemq are not durable and persistent, so in case one of your consumer is down. You would lost your messages.

To make topic durable and persistent you can create a durable consumer by creating unique client id per consumer.

But again, that is not distributed in case you are following microservices architecture. So multiple pods or replicas will create problem while consuming messages as in no load balancing is possible for durable consumers.

To mitigate this scenario, there is a option of Virtual topics in Activemq.More details have been provided below,

You can send your messages via your producer in topic named as VirtualTopic.MyTopic. ** Note: you must have to follow this naming convention for default activemq configuration. But yes there is also a way to override this naming convention.

Now, to consume your messages via multiple consumers, you have to set naming convention for your consumer side destination as well for eg. Consumer.A.VirtualTopic.MyTopic Consumer.B.VirtualTopic.MyTopic These two consumer will receive messages through the topic created above, also with load balancing enabled between multiple replicas of same consumer.

I hope this will help you fixing your problem with activemq topic.

Oceanus answered 13/7, 2021 at 10:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.