cancel
Showing results for 
Search instead for 
Did you mean: 

Process definition deployment mistakes

yangyang_qian
Champ in-the-making
Champ in-the-making
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.
2 REPLIES 2

yangyang_qian
Champ in-the-making
Champ in-the-making
er, found this topic when searching for "duplicate deployments"    http://forums.activiti.org/en/viewtopic.php?f=6&t=1524&hilit=multiple+deployments

does that mean I'll need to add  .enableDuplicateFiltering()  flag to the deployment builder?

frederikherema1
Star Contributor
Star Contributor
yes, duplicate deployments should be ignored when this flag is up… So when your process and resources haven't changed, no new deploy will be done.