How to let Camunda wait for our ProcessApplication?

At the beginning of this week we had a problem at a customer. They’re using Camunda 7.6.0 on Wildfly 10.1.
For unknwon reason Camunda stopped processing new process instances. All new process instances got stuck on the start event.
We stopped Wildfly and started it again.
During startup Camunda already started to process the queued jobs, our application was not yet completely available.
So the service task after the start event failed and we had to repair this.

How can we achieve, that the Camunda job-executor waits, until our ProcessApplication is up and running (@PostDeploy finished, registerProcessApplication done for all deployments) ?

As a easy fix to something similar, we set the retry period to something like 2 minutes. So when the first failure occurs, camunda won’t try again for a few minutes

Another solution:

  1. Set property jobExecutorActivate to false for the process engine:
    <property name="jobExecutorActivate">false</property>

  2. In ProcessApplication’s @PostDeploy method activate the JobExecutor as last step:

    public void deployed()
    {
...
        List<Deployment> deployments = this.repositoryService.createDeploymentQuery().tenantIdIn( tenantId ).list();
        for ( Deployment deployment : deployments ) {
            this.managementService.registerProcessApplication( deployment.getId(), this.getReference() );
        }

        ProcessEngineService processEngineService = BpmPlatform.getProcessEngineService();
        ProcessEngine processEngine = processEngineService.getDefaultProcessEngine();
        ProcessEngineConfigurationImpl processEngineConfigurationImpl = (ProcessEngineConfigurationImpl)processEngine.getProcessEngineConfiguration();
        JobExecutor jobExecutor = processEngineConfigurationImpl.getJobExecutor();
        jobExecutor.start();
    }