Nav

Handling Message Acknowledgement

There are different acknowledgement configurations provided by the AMQP Connector.

Automatic Acknowledgement On Success

The AUTO ackMode can be used in the amqp:listener component, causing the automatic ACK of the received Message if and only if the flow execution completes successfully. In case that an error occurs during the flow execution that causes it to terminate prematurely, then the Message will not be ACKed and redelivery will occur.

Immediate Acknowledgement

Setting the ackMode to IMMEDIATE either in amqp:listener or amqp:consume operations will cause the Message to be automatically ACKed once it is consumed, and prior to any processing of the Message by the application. Having the Message automatically acknowledged once it is received means that the Message won`t be redelivered if any error occurs during the processing of the Message, so application logic like a dead letter queue has to be created to handle errors without losing Messages.

Manual Acknowledgement

As you may expect, the MANUAL ackMode delegates all the responsibility of performing the ACK on the Message to the application logic.

With this configuration, every Message received by either the listener or consume operations will have an ackId available in the MuleMessage attributes which identifies this Message uniquely for a given channel.

The ackId that identifies the Message will then be passed on to the amqp:ack operation:


         
      
1
2
3
4
5
6
7
8
<flow name="consumerWithManualAck">
    <amqp:consume config-ref="config" queueName="${queueName}" ackMode="MANUAL" />

    <!--Do message processing-->
    <logger message="#[payload]">

    <amqp:ack ackId="#[attributes.ackId]" />
</flow>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+