cancel
Showing results for 
Search instead for 
Did you mean: 

Email Service Error Handling

gavnunns
Champ on-the-rise
Champ on-the-rise
Hi,

I have BPMN flow that uses the email task in several places.  If this email task fails for any reason I would like the process to proceed as normal, maybe with a script task will logs the issue.  I have tried to use the error boundary event however one of the errors I am receiving during the email task is java exception javax.mail.MessagingException which as the documentation indicates is not caught by the error boundary event.

What is the best practice to maintain a process flow through both just java and business exceptions.

Thanks
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
Boundary error-event will only work for:
1) BPMN Error-events  thrown in the process
2) BPMNError exception thrown from within the process execution code.

A solution whould be to wrap the email-behaviour Service-task in a try-catch, wrapping the javax.mail-exception in a BPMNError and throwing that instead. Alternatively, you can just create a JavaDelegate which does the error-handling and logging itself, rather than modelling this in the process. The advantage of a JavaDelegate opposed to a ScriptTask is the fact that you can re-use the logic across multiple process-definitions…

pmsevestre
Champ in-the-making
Champ in-the-making
In my process implementations I usually don't use the e-mail task. Instead, I prefer to use a system task for this, where I can have full control of the error handling.