cancel
Showing results for 
Search instead for 
Did you mean: 

DeploymentBuilderImpl - isDuplicateFilterEnabled

davejenknz
Champ in-the-making
Champ in-the-making
Activiti 5.6
I'm using SpringProcessEngineConfiguration to deploy resources.
Each time the container is restarted the same (unchanged) resources are deployed  again.
In DeploymentBuilderImpl I notice that the flag isDuplicateFilterEnabled is unused. Is this a bug thats being worked on?

Dave
5 REPLIES 5

trademak
Star Contributor
Star Contributor
Hi,

In the DeployCmd you can find the following lines:

if ( deploymentBuilder.isDuplicateFilterEnabled() ) {
      DeploymentEntity existingDeployment = Context
        .getCommandContext()
        .getDeploymentManager()
        .findLatestDeploymentByName(deployment.getName());
     
      if ( (existingDeployment!=null)
           && !deploymentsDiffer(deployment, existingDeployment)) {
        return existingDeployment;
      }
    }

This should prevent the deployments from being deployed over and over again (if you set the duplicateFilterEnabled to true)

Best regards,

davejenknz
Champ in-the-making
Champ in-the-making
Hi,

FYI I'm running Spring 3.0.5, Activiti 5.6, Postgres 8.4, Java 1.6. I'm configuring the SpringProcessEngineConfiguration in a @Configuration bean.

I'm using an SpringProcessEngineConfiguration instance which does allow me to directly set isDuplicateFilterEnabled.

Looking at the SpringProcessEngineConfiguration code I see that the autoDeployResouces method creates a deployment builder and it calls enableDuplicateFiltering.
Debugging the code shows that autoDeployResouces is called and that the DeploymentBuilderImpl has got the isDuplicateFilterEnabled variable set to true.

However, the unchanged resources are still being written to act_re_deployment and act_ge_bytearray.


Dave

frederikherema1
Star Contributor
Star Contributor
I'll have a deeper look at this, in some circumstances I've seen this behaviour, issue already exists: ACT-845

seanmills
Champ in-the-making
Champ in-the-making
I ran into this issue as well.  I evaluated the DeployCode.deploymentsDiffer() method and found savedResources contains a png for one of my deployments, however I never deployed a png resource in any previous execution.  Do I need to do something different or does the code below need to change?

  protected boolean deploymentsDiffer(DeploymentEntity deployment, DeploymentEntity saved) {
    Map<String, ResourceEntity> resources = deployment.getResources();
    Map<String, ResourceEntity> savedResources = saved.getResources();
    if (!resources.keySet().equals(savedResources.keySet())) {
      return true;
    }

    for (String resourceName: resources.keySet()) {
      ResourceEntity resource = resources.get(resourceName);
      byte[] bytes = resource.getBytes();
      ResourceEntity savedResource = savedResources.get(resourceName);
      byte[] savedBytes = savedResource.getBytes();
      if (!Arrays.equals(bytes, savedBytes)) {
        return true;
      }
    }
    return false;
  }

Thanks
Sean

seanmills
Champ in-the-making
Champ in-the-making
I found the issue already logged in Jira and scheduled for 5.8…  http://jira.codehaus.org/browse/ACT-736