Recently I’ve been working with ActiveMQ virtual destinations. In some cases it can be a really useful technique to scale up your topic consumers. I’ve posted my abbreviated notes below.
Virtual Destinations are logical destinations (i.e. Queues or Topics) that map onto one or more physical destinations. Their purpose is to overcome some load balancing/HA limitations with durable subscribers.
How it works:
1) Producer sends to the logical topic “MyTopic”
2) Consumer A can consume from the “MyTopic” as a normal Topic consumer.
3) Consumers B & C can also consume, via a dedicated physical queue linked to the logical topic. The link part is really what changes a regular topic into a virtual topic. So now we have a setup like this:
[producer] --> [MyTopic] --> [TopicConsumerA] --> [VirtualQueueConsumer.MyTopic] --> [QueueConsumerB][QueueConsumerC]
Note: “VirtualQueueConsumer.MyTopic” is a physical queue. This means you can have a pool of consumers consuming from the queue, allowing you to overcome some of the limitations of durable subscribers.
Configuration for virtual destinations is via the brokers /conf/activemq.xml:
<destinationInterceptors> <virtualDestinationInterceptor> <virtualDestinations> <!-- deliver traffic from virtual 'MyTopic' to all subscribers to destinations matching the prefix "VirtualQueueConsumer.*" (queue or topic) --> <virtualTopic name="MyTopic" prefix="VirtualQueueConsumer.*." /> </virtualDestinations> </virtualDestinationInterceptor> </destinationInterceptors> </broker>
Hello Dave, We use ActiveMQ @ Home depot. And we are recently exploring the option of Virtual destinations for topics.
We found that, Consumers registered to Virtual Topic only receives message from Topics when there is a active Consumer on that Queue.
However, we have a requirement where we want to accumulate the messages in VirtualConsumer Queue if Consuming application is down.
We dont want to loose the messages from topic if application is down.
Is this possible? is there any easy configuration change required to achive this.
Please suggest. thanks a ton in advance.
regards
Ambarish