Camel, JMS, CLIENT_ACKNOWLEDGE mode

I know that the Camel JMS component uses Springs DefaultMessageListenerContainer to receive messages. It can be configured to use the CLIENT_ACKNOWLEDGE mode to acknowledge messages. My question is: when is the message.acknowledge () method called? Is this an internal container for spring listener?

Or can I somehow confirm the message of my own free will?

I would like to avoid the scenario that messages are lost because my application crashed while processing these messages and makes the transaction too heavy for me.

+6
source share
1 answer

OK After some debugging and scanning of the source code, I found that Camel uses spring MessageListenerContainers. AbstractMessageListenerContainer, in case of CLIENT_AKNOWLEDGE mode, calls the comitIfNecessary message confirmation method. This only happens after a registered MessageListener successfully completes the process (no exceptions)

Camel uses an EndpointMessageListener, which, in the end, calls the processing method of the next processor (or Producer) along the route. Since this is a classic chain of responsibility, if any processor along the route throws an exception or sets an exception on Exchange, it will restart the EndpointMessageListener, preventing the AbstractMessageListener from being notified.

+8
source

All Articles