java – MessageConsumer / MessageProducer vs QueueSender / QueueReceiver

Is messageconsumer / messageproducer equivalent to queuesender / queuereceiver?

As far as I know, messageconsumer / messageproducer is more suitable for use in XA context

In my application, I want to switch from queueconnectionfactory, queueconnection and queueSession to their XA equivalents. For this purpose, I need to use messageconsumers / receivers instead of queuesenders and queuereceivers

Solution

No, queuesender extends messageproducer and provides some additional queue - specific methods It has nothing to do with Xa The same relationship exists between queuereceiver and messageconsumer

Again, this has nothing to do with Xa Unless you specifically need additional methods provided by queuesender / queuereceiver, it is usually best to write the messageconsumer / messageproducer interface in any JMS code

No Whether you use XA has nothing to do with the API interface you choose The XA behavior is determined by the queueconnectionfactory you get from the application server Most will provide you with XA or non Xa queueconnectionfactory. Usually, you can get the appropriate path on different JNDI paths

Once you have the right queueconnectionfactory, your application should not care if XA is used

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>