Hi Manuel,

Maybe the OnCompletion concept would be useful for your case: https://camel.apache.org/manual/latest/oncompletion.html

You can specify a route which will be executed only if the main route fails.

Regards,
Karen

On 07/07/2021 15:30, Shenavai, Manuel wrote:
Hi everyone,

we are using the camel mail component to fetch mail from the server. Occasionally we 
have mails that we are not able to fetch (i.e. mail is malformed). In those cases we 
skip the mail and exclude it from the mail (mail configuration: 
skipFailedMessage<https://camel.apache.org/components/latest/mail-component.html>=true).

Here is where the error occurs:
https://github.com/apache/camel/blob/main/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java#L412

And is the exception caught and logged:
https://github.com/apache/camel/blob/main/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java#L435

Now we would have to have a enhanced error handling which requires access to 
the exchange of the failed message. I found in the documentation the bridge 
error handler. Would this error handler help us to get the exchange of the 
failed message? From the code above it seems like that the exchange is lost and 
will not be available for error handling.
https://camel.apache.org/manual/latest/faq/why-does-my-file-consumer-not-pick-up-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.html

Best regards,
Manuel

Reply via email to