Retry the Service task from failed state

Hi, I am new to flowable and I m trying to implement for our application. I created below simple service flow and I was able to start and complete the tasks. But the issue is, when the Create Account task is failed, I could not see any way to retry the task from Create Account and it is starting from ‘Initiate’ , Reserve Account and then to Create Account task. The process status also pending with ‘Initiate’

My requirement is to continue the process one by one and should able to retry the task from where it is failed. How did we solve/design the process for these scenario.

Thanks

Flowable does all its work from wait state to wait state. A wait state is a section of the process that causes the process to be persisted to the database, usually because it has to wait for some thing. If an error occurs Flowable rolls back the transaction to the previous wait state, and usually write some error information to the log.

In your case, I would suggest marking you service tasks, or at least the create account task as asynchronous. This will force a wait state and schedule a job to continue the service task later. If there’s an error, the AsyncExecutor will automatically retry 3 times (by default). If it fails the third time the job gets placed in a dead letter queue for you to handle later. Dead letter queue jobs can be retried either using an API or the Flowable Admin UI tool.

1 Like

Thanks for replying me.

Is flowable:async=“true” will make the service task as synchronize?.

Thanks

Setting flowable:async="true" will mark a service task as asynchronous.

1 Like

Thanks a lot.

I am able to configure asynchronous service task and the job is retrying as expected.
But, I am not able to see the process status/task details when the service task is failed and waiting for retry

Is there any way that I can pull the current process’s status(Pending or Error). I am trying with this API call but I am not getting task details for this process.

     TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processId);
      for(Task task: taskQuery.list()){    				
		LOG.debug("Task Id:::"+task.getId());
    	LOG.debug("Form Key:::"+task.getFormKey());
    	LOG.debug("Task Def key:::"+task.getTaskDefinitionKey());
    	LOG.debug("Process Id:::"+task.getProcessInstanceId());;
    	LOG.debug("Priority:::"+task.getPriority());
    	LOG.debug("Name:::"+task.getName());}

When an async job fails its retries, it will be moved to the deadletter jobs. You can query those via the managementService#createDeadLetterJobQuery api

1 Like

Thanks for responding.

Is there any way to get the process status or job status while asyn job is in progress.
I configured the job retry time cycle with R5/PT30M. So it may makes 2.30 hours to move the job to DeadLetter. But I am looking for the process status(Pending, job in progress, etc) during these time period.

If a job fails and needs to be repeated, it is changed to a TimerJob until the time for retry is arrived. So you can query for those jobs and this would tell you the job is ‘in progress’.

2 Likes