Spring DLMC and JMSTemplate behavior while using T

2019-06-11 01:09发布

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条回答
对你真心纯属浪费
2楼-- · 2019-06-11 01:55

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.
查看更多
登录 后发表回答