cancel
Showing results for 
Search instead for 
Did you mean: 

SpringProcessEngineConfiguration - autodeploy

chris889
Champ in-the-making
Champ in-the-making
Hi,

Is there a built in way to auto-deploy bpmn resources only if there has been a change in the bmn20.xml file? Setting the deploymentResources property of the SpringProcessEngineConfiguration bean seems to deploy everytime the spring container is started.

br
Christoph
15 REPLIES 15

frankee787
Champ on-the-rise
Champ on-the-rise
Hmmm…thats pretty disappointing.  Does it really fail only in Oracle? Cause mine is MySQL  and still it fails.

frankee787
Champ on-the-rise
Champ on-the-rise
Thanks for the quick reply. I just wrote my own deployer bean, you can find it here for reference: http://pastebin.com/JU4J0rCr.

How are you instantiating the bean in spring context?

Regards,
Franklin

chris889
Champ in-the-making
Champ in-the-making
Well, I just reference it in my spring applicationcontext.xml configuration file (i.e. <bean class="org.this.is.my.namespace.WorkflowDeployer"/>)

frankee787
Champ on-the-rise
Champ on-the-rise
For me it gives an error as follows



[2011-10-17 11:14:33,062] org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workflowDeployer' defined in file [C:\ApacheTomcat\apache-tomcat-6.0.28\webapps\WEB-INF\classes\activiti.cfg.xml]: Invocation of init method failed; nested exception is org.springframework.beans.FatalBeanException: Missing property: category
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

sanjiv
Champ in-the-making
Champ in-the-making
Is this feature still broken? Spring "deploymentResources"  setting results in a new deployment in the Activiti tables each time the app is restarted. http://jira.codehaus.org/browse/ACT-736 is marked fixed in Activiti Engine 5.9 in Feb 2012. Which version of Activiti does this correspond to? I'm using v5.12.1 and I'm facing the same issue.

Thanks,
Sanjiv

frederikherema1
Star Contributor
Star Contributor
We have a test for this: org.activiti.spring.test.autodeployment.SpringAutoDeployTest.testNoRedeploymentForSpringContainerRestart, which runs green on our QA (against H2).

public void testNoRedeploymentForSpringContainerRestart() throws Exception {
    createAppContext(CTX_PATH);
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
    assertEquals(1, deploymentQuery.count());
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
    assertEquals(3, processDefinitionQuery.count());
   
    // Creating a new app context with same resources doesn't lead to more deployments
    new ClassPathXmlApplicationContext(CTX_NO_DROP_PATH);
    assertEquals(1, deploymentQuery.count());
    assertEquals(3, processDefinitionQuery.count());
  }

Actual code that checks the duplicates:

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

Deployment is looked up by name (in this case, SpringAutoDeployment) and all non-generated resources are checked to see if they differ (byte-level). If they differ, a new deployment is created.

What DB are you on? only thing I can think of is that the bytes returned from the database are a bit different than the bytes from the actual files on the hard disk (maybe encoding?).