cancel
Showing results for 
Search instead for 
Did you mean: 

Switching to AsyncExecutor

sankalpn
Champ in-the-making
Champ in-the-making
Hi all, I am trying to switch to AsyncExecutor and want to set it up in a clustered mode (enabled on all servers). My process engine configuration looks like this:


  @Bean(name = "processEngineConfiguration")
  public ProcessEngineConfigurationImpl processEngineConfiguration() {
    SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
    processEngineConfiguration.setClassLoader(getClass().getClassLoader());
    processEngineConfiguration.setDataSource(dataSource()); // This is a postgres DB
    processEngineConfiguration.setDatabaseSchema(activitiSchema); // Have a separate schema for activiti
    processEngineConfiguration.setDatabaseSchemaUpdate("true");
    processEngineConfiguration.setTransactionManager(annotationDrivenTransactionManager());
    processEngineConfiguration.setJobExecutorActivate(false);
    processEngineConfiguration.setAsyncExecutorEnabled(true);
    processEngineConfiguration.setAsyncExecutorActivate(true);
    processEngineConfiguration.setHistory("full");
    processEngineConfiguration.setMailServerHost(mailServer);
    processEngineConfiguration.setMailServerPort(mailServerPort);
    return processEngineConfiguration;
  }


But when I tested a workflow with two servers, I saw both servers executed a task from the same process instance. Is this expected? How can I configure the process engine so that only one server executes any given task?

Thanks,
Sankalp
10 REPLIES 10

jbarrez
Star Contributor
Star Contributor
thanks for posting back. That does explain it 🙂