Question

I'm running ActiveMQ in a production system. Some of our queues are very high volume and some are very low volume. I'm interested in mirroring one of the low volume queues so that I can build informal monitoring services around the messages being received.

Unfortunately, the only documentation I've been able to find seems to imply that Mirrored Queues are are all-or-nothing: you either create a topic for every single queue you have (and suffer the performance penalty of copying every message flowing through your system), or you can't use the feature at all.

Is there no way of enabling this helpful functionality for a single, known queue name?

Était-ce utile?

La solution

You can mirror single queues like this:

<destinationInterceptors>
    <virtualDestinationInterceptor>
        <virtualDestinations>
            <compositeQueue name="YOUR.QUEUE" forwardOnly="false">
                <forwardTo>
                    <queue physicalName="MIRROR.OF.YOUR.QUEUE"/>
                </forwardTo>
            </compositeQueue>
        </virtualDestinations>
    </virtualDestinationInterceptor>
</destinationInterceptors>

You can find the documentation for virtual destinations here.

Autres conseils

Despite all the time passed since this question was asked, I am going to publish this answer just in case someone reaches here looking for the same thing as I did. I hope it helps the discussion.

Unfortunately, as far as I know and have tried (for solving a particular issue similar to yours), it is not possible to enable the functionality of Mirrored Queues for just one queue in a broker configuration with multiple queues. As of today, as you said, you would have to suffer that performance penalty by copying every message flowing through that broker.

But the Mirrored Queues are a setting scoped in the broker configuration and therefore, there is an alternative to that (not saying is going to be easier or free of performance cost). You might have another broker that communicates with your main broker, in which to include only those queues that you need to mirror/monitor. Of course this would make the architecture of your system more complex since you need to communicate 2 brokers (with its subsequent latency impact in the communication between them), but at least you would not need to create a mirrored queue for all the queues in your system, and in case you had a system with thousands of queues and just wanted to mirror very few of them, this might be an alternative to consider.

The answer from Ralf I believe does not answer your question, since for forwarding to a mirrored queue, you would have to activate that functionality previously for all the queues in the broker, that is what you do not want. Due to my account reputation is under 50 I cannot comment under his answer, that's why I write it here.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top