Spring DLMC and JMSTemplate behavior while using Transactions

懵懂的女人 提交于 2019-12-23 06:06:07

问题


I have a some questions regarding transactions in DMLC and JMSTemplate.

  1. Does Spring DMLC receive messages asynchronously using callbacks if we are not using transactions ?

  2. Does DMLC also receive messages asynchronous while using transacted session. (setting sessionTransacted to true). What is the behavior after setting sessionTransacted to true ?

3, What is the difference between AUTO_ACK and SESSION_TRANSACTED mode from consumer's prospective. In AUTO_ACK mode DMLC send acknowledgement to the broker after message is received. Similarly in SESSION_TRANSACTED mode DMLC commits after each message received. Which is the better way in terms of performance and what is the difference?

4 Does JMSTemplate message sending is always synchronous. Even if It is sending non persistent messages to a topic ?

Thanks, Anuj


回答1:


The DMLC is not receommended to be used without transactions; use the SMLC.

When using transactions, the container commits the session when the thread returns. Yes, they are handled asynchronously.

With auto ack and the DMLC, the session is acked as soon as the receive() happens (and before the listener is invoked) - hence it really is best for transactions.

  1. That's a function of the JMS client library but generally, yes; especially if using transactions.


来源:https://stackoverflow.com/questions/24266881/spring-dlmc-and-jmstemplate-behavior-while-using-transactions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!