My use case is sending mail via SMTP outbound endpoint.
I use Mule AMQP Connector with ackMode="MULE_AUTO"
.
I tried using rollback exception strategy but that does not seem to work.
Does anyone know if it is possible to reject and requeue the message ?
(Mule ESB CE 3.7.0 - Mule AMQP Transport 3.6.2.20150520)
Yes It is possible.
You need to use ackMode=Manual
1) For success scenario : you need to manually acknowledge the message by using <amqp:acknowledge-message />
at the end of the flow or where you feel in your logic message can be acknowledged.
2) For failure scenario: Validation error etc, when the exception throws it will be caught in catch exception strategy - use <amqp:reject-message />
. It helps in rejecting the message.
3)For connection exception: In catch exception strategy use <amqp:reject-message requeue="true" />
which will again push the original message back to the same queue. Reference:https://github.com/mulesoft/mule-transport-amqp/blob/master/GUIDE.md#manual-message-acknowledgement-and-rejection
Both 2nd and 3rd scenarios needs to be handled in exception strategy. So use ChoiceException strategy
where in use 2 catch exception strategy
defining one for 'validation error' and other with 'connection Exception'. Reference:https://docs.mulesoft.com/mule-user-guide/v/3.7/choice-exception-strategy
Note: When using Manual ack
, irrespective of success/failure scenario need to manually acknowledge or reject message externally. Missing any keep the message present in the queue.