MessageConsumer / MessageProducer vs QueueSender / QueueReceiver

Is MessageConsumer / MessageProducer equivalent to XA QueueSender / QueueReceiver ?

As I understand it, MessageConsumer / MessageProducer best used in the context of XA.

In my application, I want to switch from QueueConnectionFactory , QueueConnection , QueueSession to their XA equivalent, and for this I will need to use MessageConsumers / Receivers instead of QueueSenders and QueueReceivers .

+7
source share
1 answer

Is MessageConsumer / MessageProducer equivalent to XA QueueSender / QueueReceiver ?

Not. QueueSender extends MessageProducer and provides some additional queue-specific methods. This has nothing to do with XA. The same relationship exists between QueueReceiver and MessageConsumer .

As I understand it, MessageConsumer / MessageProducer best used in the context of XA.

Again, this has nothing to do with XA. It is usually best to write MessageConsumer / MessageProducer interfaces in any JMS code unless you need the additional methods provided by QueueSender / QueueReceiver .

In my application, I want to switch from QueueConnectionFactory , QueueConnection , QueueSession to their XA equivalent, and for this I will need to use MessageConsumers / Receivers instead of QueueSenders and QueueReceivers.

Not. Whether you use XA or not, you have nothing to do with your choice of API. The behavior of XA is determined by what QueueConnectionFactory you get from the application server. Most of them will provide you with either an XA or non-XA QueueConnectionFactory , usually in a different JNDI path, and it's up to you to get one.

Once you have the correct QueueConnectionFactory , your application does not have to worry about whether XA is used or not.

+12
source

All Articles