cancel
Showing results for 
Search instead for 
Did you mean: 

Mail Task Transaction

jatz
Champ in-the-making
Champ in-the-making
We have a flow where a user task is executed by the user which takes the flow to a service task. After this task is complete a mail notification is sent. The flow then moves to the next user task.

Initially this was all in sync and worked fine. The issue happened when we had a error thrown from the db layer after the first user task completed. This resulted in the transaction rolling back, but the mail notification was sent as the exception happened after the mail task was called. (persisting to the db using Spring/JPA).

I changed the mail task to be async="true" which resolves this issue. The question I had was regarding the mailtask. If the mailtask fails (say mail server is down or some other reason), would this process be stuck. Or after 3 retries will the process move to the next task (2nd user task?)
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
If the async task fails 3 times (the number of retries are configurable by the way), the job is kept in the database with 'retries = 0'. This won't be retries anymore, unless triggered manually by the API (or explorer). If you have async stuff in your process, you should have a mechanism that inspects the failed jobs (see JobQuery, this offers functionality to find those jobs and look at the exception that occurs) on a regular basis.

Anyway, the process won't move on and will be "waiting".

jatz
Champ in-the-making
Champ in-the-making
That answers my question. Just a question on this - say in our example, the mail task may be an activity to be performed, but its failure not too critical. This would imply that the process can still move to the next state. In this case is the only option currently to extend MailActivitiyBehavior? Would an option on the mail task be helpful to log the exception and continue on?

frederikherema1
Star Contributor
Star Contributor
You can use a regular JavaDelegate for this and try-catch-ignore the exception in the execute() method. Activiti will consider the delegate as being executed without errors and continues it's flow.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.