How to force Activiti to retry a failed service task attached to a boundary event?

cancel
Showing results for 
Search instead for 
Did you mean: 
douglascrp
Advanced II

How to force Activiti to retry a failed service task attached to a boundary event?

Jump to solution

I am using the Activiti engine embeded with Alfresco 5.0.d.

In my workflow I have some boundary events, all of them attached with some service tasks used to send emails about expired tasks.

There are moments where, because of connectivity issues, Alfresco is unable to reach the mail server, and as the execution fails, users receive no emails.

I was looking at the database tables, and I found out this one ACT_RU_JOB.

In that table, I see the failed task is there.

Is it possible to force Activiti to retry it by updating any of the table's columns?

This is the register I am talking about:

| ID_   | REV_ | TYPE_ | LOCK_EXP_TIME_ | LOCK_OWNER_ | EXCLUSIVE_ | EXECUTION_ID_ | PROCESS_INSTANCE_ID_ | PROC_DEF_ID_           | RETRIES_ | EXCEPTION_STACK_ID_ | EXCEPTION_MSG_                                                                                                                                                                                                                                                  | DUEDATE_            | REPEAT_ | HANDLER_TYPE_    | HANDLER_CFG_   | TENANT_ID_ |
+-------+------+-------+----------------+-------------+------------+---------------+----------------------+------------------------+----------+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------------------+----------------+------------+
| 43144 |    7 | timer | NULL           | NULL        |          1 | 43143         | 43061                | termo_quitacao:3:41904 |        0 | 44747               | 03070039 Failed to execute supplied script: Error creating bean with name 'mail' defined in URL [jar:file:/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-5.0.d.jar!/alfresco/subsystems/email/OutboundSMTP/outboundSMTP-context.xml]:... | 2017-04-07 10:27:40 | NULL    | timer-transition | boundarytimer1 |            |

Thank you.

1 Solution

Accepted Solutions
douglascrp
Advanced II

Re: How to force Activiti to retry a failed service task attached to a boundary event?

Jump to solution

Nice. I was playing around with that even before seeing that thread (I know that playing with the database can be dangerous, but I decided to take the risk in this case).

My update statement looks like this: update ACT_RU_JOB set RETRIES_ = 3 where ID_ = 43144;

That seems to be exactly what was suggested in this answer https://community.alfresco.com/thread/222291-restart-process-after-exception#comment-790361 

After that change, the task got executed again.

Thank you.

View solution in original post

5 Replies
jearles
Established Member II

Re: How to force Activiti to retry a failed service task attached to a boundary event?

Jump to solution

Douglas,

This question has come up before on the forums, in this post. As stated, you could either reset the number of retries for the job and the executor should pick it up again - OR you can manually trigger the job to try again using managementService.createJobQuery to get the job, and the managementService.executeJob().

Does this fit your criteria for a fix?

Hopefully you'll be set on the right track Smiley Happy

-JEarles

douglascrp
Advanced II

Re: How to force Activiti to retry a failed service task attached to a boundary event?

Jump to solution

Nice. I was playing around with that even before seeing that thread (I know that playing with the database can be dangerous, but I decided to take the risk in this case).

My update statement looks like this: update ACT_RU_JOB set RETRIES_ = 3 where ID_ = 43144;

That seems to be exactly what was suggested in this answer https://community.alfresco.com/thread/222291-restart-process-after-exception#comment-790361 

After that change, the task got executed again.

Thank you.

douglascrp
Advanced II

Re: How to force Activiti to retry a failed service task attached to a boundary event?

Jump to solution

I got one more question about this.

Will the duedate update force the execution to wait to try again after the set date?

I was updating it for like, 5 minutes after "now".

cjose
Senior Member II

Re: How to force Activiti to retry a failed service task attached to a boundary event?

Jump to solution

Yes, it should be picking up the jobs based on the due date.

Regards,

Ciju

douglascrp
Advanced II

Re: How to force Activiti to retry a failed service task attached to a boundary event?

Jump to solution

Thank you.