问题
I have a some questions regarding transactions in DMLC and JMSTemplate.
Does Spring DMLC receive messages asynchronously using callbacks if we are not using transactions ?
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.
- 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