AnsweredAssumed Answered

Process definition deployment mistakes

Question asked by yangyang.qian on Jun 13, 2011
Latest reply on Jun 14, 2011 by frederikheremans1
Recently, I've noticed that our Activiti schema tables seems to be tracking multiple deployments of the same two process definitions that we've been running our tests on. I thought that only changes to the process definition would create a new deployment record? If that's the case, there appears to be more entries than there should be (since we haven't been making that many changes to the two test processes) and I'm afraid might be due to our process deployment code …

I am pretty sure we haven't quite figured out how to deploy our business processes correctly, and was hoping if someone can give us some hints. Right now we are running the following lines of code on our ProcessEngineServletContextListener class … which get run whenever our webapp container starts up or shuts down I think


public class ProcessEnginesServletContextListener implements ServletContextListener {

   private static final String CONFIG_FILE = "activiti.cfg.xml";
   
   @Override
   public void contextInitialized(ServletContextEvent arg0) {
      try {
         ProcessEngines.init();         
      } catch(Exception ex) {
         throw new RuntimeException("Could not initialize process engine in context.", ex);
      }
      
      try {
         //loads the appropriate workflow process.
         ProcessEngine       processEngine       = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(CONFIG_FILE).buildProcessEngine();
         RepositoryService    repositoryService    = processEngine.getRepositoryService();
         final String process01 = "com/bnp/application/wfe/diagrams/newhire.bpmn20.xml";
         final String process02 = "com/bnp/application/wfe/diagrams/extendstaff.bpmn20.xml";
         DeploymentBuilder    deploymentBuilder    = repositoryService.createDeployment();
         deploymentBuilder.addClasspathResource(process01);
         deploymentBuilder.addClasspathResource(process02);
         Deployment         deployment          = deploymentBuilder.deploy();
         
      } catch(Exception ex) {
         throw new RuntimeException("Could not load workflow process.", ex);
      }
   }
   
   @Override
   public void contextDestroyed(ServletContextEvent arg0) {
      ProcessEngines.destroy();
   }



}

Though I've read the User Guide's sections regarding the Activiti Probe and the Bar … I don't think I quite understand them. And I don't know if the previous code is just the wrong way to go about doing it.

Outcomes