0
votes

In a question and response here:

ActiveMQ Producer Multiple Queues One Session

The topic of a single producer sending messages to more them one destination is covered with a solution in Java.

Can the same thing in CPP/CMS be done?

I've tried to replicate that code using cms/activemq API but when I try to send a message to a different queue(destination), I receive error messages stating the producer can only send to the old destination.

Without writing the exact code here is the flow...

  • Create new Factory
  • Set broker URI
  • Create Connection
  • Connection start
  • Create Session
  • Create MessageProducer with a temporary queue
  • Create a new queue
  • Use session to create message
  • MessageProducer send using new queue and message
1
Show your code so we can see if it is correctTim Bish

1 Answers

0
votes

It is unclear what you code has done since you didn't include it but given the minimal input my guess is that you are creating a fixed destination producer by calling session->createProducer with some destination (sounds like a temp queue). This creates a producer married to that destination for life and calling the send methods that take a destination are required to throw. If you want to pool a producer and send to many different addresses then you need to create it with a NULL destination.