How do I send messages to different Destinations from a single MessageProducer

 FAQ > JMS > How do I send messages to different Destinations from a single MessageProducer

How do I send messages to different Destinations from a single MessageProducer?

Create the MessageProducer using a null destination; then specify the destination each time you send…

MessageProducer producer = session.createProducer(null);
...
producer.send(someDestination, message);
...
producer.send(anotherDestination, message);

Apache, ActiveMQ, Apache ActiveMQ, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. Copyright © 2024, The Apache Software Foundation. Licensed under Apache License 2.0.