3

I know that JmsTemplate may be shared between multiple threads and used concurrently for sending messages.

But what if I want to share one instance, but send messages with different QoS params - say different priority.

As far as I can see in the source code, if QoS is enabled, JmsTemplate uses the overloaded version of the Producer.send() with QoS and there is no other way to pass these parameters from outside (apart from setting them directly into a JmsTemplate instance)

Setting QoS into a single shared JmsTemplate instance right before sending a message is not an option for known reasons.

So the questions are:

  • is there a good solution to keep one JmsTemplate instance and send messages with beforehand-unknown QoS (e.g. passed from outside)?

  • If there is not, how "dirty" is it to create a new instance on each send call then?

Average Joe
  • 643
  • 5
  • 15

0 Answers0