0

I have couple of questions regarding spring DMLC.

  1. Why it is recommended by spring vendors to use DMLC(Default Message Listener Container) with transactions?

Spring DLMC and JMSTemplate behavior while using Transactions

  1. On consumer side if I use DMLC with sessionTransacted=false, it will use ACTO_ACK mode by default. What is the difference between both the cases (Transactions and AUTO_ACK) ? According to my understanding, Acknowledgement process looks similar to me in both the cases:

Transacted: As soon as message is received by the consumer, a commit will be send to broker and thn only broker will consider message as delivered.

Auto_Ack: Here also for each message received by the consumer, a acknowledgement will be send to the broker by consumer.

Please correct me if I am wrong.

Thanks,

Anuj

Community
  • 1
  • 1
Anuj Khandelwal
  • 835
  • 2
  • 15
  • 31

1 Answers1

1

With the DMLC and auto ack, the message is acked as soon as it is received (and before the listener is called).

With transacted, the session is committed after the listener is called; and, if the listener throws an exception (or the system loses power), the transaction is rolled back (message requeued).

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • Thanks Gary. Which means performance wise AUTO_ACK is better than transactions? and Why it is recommended by spring vendors to use DMLC(Default Message Listener Container) with transactions? – Anuj Khandelwal Jul 09 '14 at 11:39
  • It entirely depends on your requirements; if you don't care about losing messages then, yes, it will be slightly faster. If you care about losing messages, you need transactions. Consider using the `SimpleMessageListenerContainer` instead of `DMLC` if you don't need transactions. – Gary Russell Jul 09 '14 at 12:12