Starting the process instance asynchronusly

Hello,

I have a process definition, I am submitting a form from drupal to the process definition. The issue is, I get a curl timeout error when I submit the form as the process is not commited to the database until the end. I suppose the whole process runs in memory and there is a long running operation in my process definition. So the form submit does not get a response for 30 sec and it gets timed out.

I have tried to put Async before in the start process, I do not get the curl timeout error now, but all my scripts in the process is executed more than once.

Could someone please help me with this. I want the process instance to be created as soon as the form is submitted and I do not want my tasks in the process to run more than once.

I think it has something to do with Retry Time Cycle . What should be set so that there are no retries.

Is this a good approach, please advise.

Thanks

If you put asyncBefore for an activity it will put the job on a queue and returns to the client. The job executor by default retries three times if the background execution fails:

https://docs.camunda.org/manual/7.8/user-guide/process-engine/the-job-executor/#failed-jobs

You can configure that behavior but more important might be to find out why the execution fails.

The thing is I have a task which is a long running task. It waits for a VM to be cloned and waits till a process in the VM is made available. This take a while ( more than 5 min )

Hi,

The job executor which runs an async continuation will typically lock a job for 5 minutes. If the job has not completed after 5 minutes, the job executor may assume that the prior attempt failed and thus it may acquire and initiate the job again. This can explain why your tasks get run more than once.

You may want to increase the lockTimeInMillis parameter [1]

regards

Rob

[1] https://docs.camunda.org/manual/7.8/reference/deployment-descriptors/tags/job-executor/#job-acquisition-configuration-properties

Thank you for your response. This looks promising, but, I can handle errors in the BPMN, is there a way I set retry to 0 ?

Handle errors:

https://docs.camunda.org/manual/7.8/reference/bpmn20/events/error-events/

Disable retry:

https://docs.camunda.org/manual/7.8/user-guide/process-engine/the-job-executor/#failed-jobs

Global:

<process-engine name="default">
  ...
  <properties>
    ...
    <property name="failedJobRetryTimeCycle">R0/PT5M</property>
  </properties>
</process-engine>

In the process activity:

<serviceTask id="failingServiceTask" camunda:asyncBefore="true" camunda:class="org.mycompany.FailingDelegate">
    <extensionElements>
      <camunda:failedJobRetryTimeCycle>R0/PT5M</camunda:failedJobRetryTimeCycle>
    </extensionElements>
 </serviceTask>

Thank you, I have just tried that and now tomcat does’t start and throws the following error

ENGINE-08040 Cannot find setter for property ‘failedJobRetryTimeCycle’ on class ‘org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration’

Is it something to do with the “StandaloneProcessEngineConfiguration”

Please assist

The global setting for the engine seems to be new in 7.8

https://app.camunda.com/jira/browse/CAM-8087

You have to use 7.8 or later or configure the retry cycle for the activity in your model (second example above).

1 Like