cancel
Showing results for 
Search instead for 
Did you mean: 

about postgreSql autoDeployResources

allenyoung
Champ in-the-making
Champ in-the-making
HI,
     Currently I'm using Activiti 5.14.
     When I use Spring autoDeployResources,it will always create a new deploy even this deploy has saved.
     mydb is postgreSql and is on Linux(CentOS),and activiti server is on win7.
     I try to get the reason that when the server run this method DeployCmd.deploymentsDiffer(DeploymentEntity deployment, DeploymentEntity saved){},it will get two defferent byte[].
4 REPLIES 4

sathish1
Champ in-the-making
Champ in-the-making
My understanding is, it will deploy when the system senses if there is any change in the bytes of file that has the deployment resources., so technically if you make a change to one of the bpmn file in the resources directory, it will either increase or decrease the file size, which will be detected by the container and do a new deployment., Would be curious to know what you find.,
<code>
  protected boolean deploymentsDiffer(DeploymentEntity deployment, DeploymentEntity saved) {
   
    if(deployment.getResources() == null || saved.getResources() == null) {
      return true;
    }
   
    Map<String, ResourceEntity> resources = deployment.getResources();
    Map<String, ResourceEntity> savedResources = saved.getResources();
   
    for (String resourceName: resources.keySet()) {
      ResourceEntity savedResource = savedResources.get(resourceName);
     
      if(savedResource == null) return true;
     
      if(!savedResource.isGenerated()) {
        ResourceEntity resource = resources.get(resourceName);
       
        byte[] bytes = resource.getBytes();
        byte[] savedBytes = savedResource.getBytes();
        if (!Arrays.equals(bytes, savedBytes)) {
          return true;
        }
      }
    }
    return false;
  }
</code>

allenyoung
Champ in-the-making
Champ in-the-making
      First of all thank you for your answer.
      I don't change the bpmn file all the time,but it will create new version.  when I make a Breakpoint on your code, the bytes and the savedBytes is not equals.
     Perhaps it's the coding problem,when mydb and server all on the win7,it will not create new version.

trademak
Star Contributor
Star Contributor
Interesting, do you have any path delimiters in the bpmn xml path you deploy to the Engine?

Regards,

allenyoung
Champ in-the-making
Champ in-the-making
It's OK! postgreSql for Linux has a property “ bytea_output = 'escape' ”
Welcome to the new Hyland Connect. Get started or submit feedback.