简体   繁体   中英

ActiveMQ define message consumer when more than one consumer

I am using ActiveMQ and I have a Queue with one consumer in the production environment.

For integration testing, I created a small application that using JNDI connects to the ActiveMQ Broker and consumes from the same queue. What I want is to separate test messages and only consume them.

Is there a way to define who should be the consumer of a message? Or any other solution that could help me to achieve this?

I know one solution could be to use Mirrored Queues , but I don't want to modify my code for testing purposes.

Why do you need test messages in production? (that can easily become a ticking bomb). If you're brave enough (and potentially reckless :D), you can use a message selector , so the production consumers do not consume message tagged as test, and your test consumer only consumes test messages.

Bear in mind that some JMS brokers might slow down considerably when you use this feature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM