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 has an ackId available in the Mule Message attributes
which identifies this message uniquely for a given connection.
The ackId that identifies the message passes to the ibm-mq:ack operation:
<flow name="consumerWithManualAck">
<ibm-mq:consume config-ref="JMS_config" destination="openTickets" ackMode="MANUAL"/>
<!--Do message processing-->
<logger message="#[payload]">
<ibm-mq:ack ackId="#[attributes.ackId]"/>
</flow>
Manual Session Recovery
When using the MANUAL ackMode, all messages that are received but not
acknowledged won’t be redelivered by the broker.
If an error occurs during the message processing that prevents it
from being acknowledged, the user is responsible for manually recovering all the
messages in the session that have to be redelivered using the recover-session operation:
<flow name="consumerWithManualAck">
<ibm-mq:consume config-ref="JMS_config" destination="${destination}"
ackMode="MANUAL" target="consumedMessage" targetValue="#[message]"/>
<!--Do message processing-->
<logger message="#[payload]">
<ibm-mq:ack ackId="#[vars.consumedMessage.attributes.ackId]"/>
<error-handler>
<on-error-propagate>
<!--In case of error, recover the session-->
<ibm-mq:recover-session ackId="#[vars.consumedMessage.attributes.ackId]"/>
</on-error-continue>
</error-handler>
</flow>
Same as before, the connection used for recovering the session has to be the
same as the one used for receiving the message.