cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate Deployment of Activiti processes

jatz
Champ in-the-making
Champ in-the-making
When we deploy multiple a WAR file on tomcat from multiple boxes pointing to the same database there seem to be duplicate versions of the same process definition in the ACT_RE_PROCDEF table. The only differemnce seems to be the resource_name_ column which says that the definitions were deployed on different boxes.

My assumption was that the version comparison is based on the bytes in the depolyed bpm file and not the deployment resource file source.

The deployment is done by Spring using ProcessEngineConfiguration and I also have initialized the RuntimeService bean by

@Bean(name = "repositoryService")
public RepositoryService repositoryService() {
      final RepositoryService repositoryService = processEngine.getRepositoryService();
      repositoryService.createDeployment().enableDuplicateFiltering();
      return repositoryService;
   }

Is there anyway to prevent this duplicate initialization of resources as they are redundant in out table entries?
13 REPLIES 13

jatz
Champ in-the-making
Champ in-the-making
To clarify the above statement - we have a single WAR file which gets deployed on two instances of tomcat on different boxes pointing to the same db. Hence the deployed bpmn resources are the same file with no differences between them.

trademak
Star Contributor
Star Contributor
Do you also have the code where you do the actual deployment of the process definitions? Or did you configure this in Spring?
When you do the actual deployment in Java code you should do the enableDuplicateFiltering there not when creating the RepositoryService instance.

Best regards,

jatz
Champ in-the-making
Champ in-the-making
We deploy using Spring. The process beans are defined as below:

@Bean(name = "processEngine")
public ProcessEngine processEngine() throws Exception {
  return processEngineFactoryBean().getObject();
}

private ProcessEngineFactoryBean processEngineFactoryBean() {
  final ProcessEngineFactoryBean factory = new ProcessEngineFactoryBean();
  factory.setProcessEngineConfiguration(processEngineConfiguration());
  factory.setApplicationContext(applicationContext);
  return factory;
}

private SpringProcessEngineConfiguration processEngineConfiguration() {
  processEngineConfiguration.setTransactionManager(transactionManager);
  processEngineConfiguration.setDeploymentResources(processDefinitions());
  return processEngineConfiguration;
}

@Bean(name = "processDefinitions")
public Resource[] processDefinitions() {
  return new Resource[]{new ClassPathResource("test.xml")};
}

After this our activiti beans are defined from the processEngine as mentioned in my previous post.

I am assuming this should change to prevent the duplication. Is there any place in the code above where I should move it to?

trademak
Star Contributor
Star Contributor
But this is not the full engine configuration, do you have a Spring configuration in addition? Or do you have more code?

Best regards,

jatz
Champ in-the-making
Champ in-the-making
The initial bean which gets deployed is as below: (when the app loads up)

@Bean(name = "processEngineConfiguration")
  public SpringProcessEngineConfiguration processEngineConfiguration() {
   final SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
   config.setDataSource(dataSource);
   config.setDatabaseSchemaUpdate("NO_CHECK");
   config.setMailServerDefaultFrom("test@test.com");
   config.setCreateDiagramOnDeploy(false);
   config.setJobExecutorActivate(true);
   config.setMailServerPort(25);

   return config;
  }

This is followed by the code which is mentioned above.

So the processengineconfiguration gets initailized first and then we autowire it to the next config mentioned above:

@Autowired(required = true)
private SpringProcessEngineConfiguration processEngineConfiguration;

frederikherema1
Star Contributor
Star Contributor
What about only using the auto-deployment of processes on a single machine instead of them all?

jatz
Champ in-the-making
Champ in-the-making
Sorry that I didn't follow.

So your suggestion is that we only deploy resources from the WAR at a certain location (say machine1 or instance1) and prevent it from the other instances?

Is there an option for this in the ProcessEngineConfiguration? Also, is this a long term fix or is there any other way to prevent this by the configuration and make it machine independent?

frederikherema1
Star Contributor
Star Contributor
As a workaround, there is no way, other than having different context-files for the different machines, which isn't really ideal or keep the same config-file but make sure the nodes don't start simultaneously. There is definitely an issue with duplicate processes being deployed so it seems, this should be fixed.

Can you create a JIRA-issue for this in our jira?

jatz
Champ in-the-making
Champ in-the-making
I will log a JIRA issue for this.

For now we are working around this by adding a system level property on tomcat startup so that only one instance deploys the process definitions and the others do not.