2 Replies Latest reply on Feb 8, 2010 12:07 PM by tcr

    Does anyone know how to deploy ProcessDefintion in JBPM 4.2

    kot.filemon

      I am facing a serious problem, which can a blocker for us.

       

      I have wrote a small piecie of code that builds ProcessDefintion.

       

      ProcessDefinitionBuilder builder = ProcessDefinitionBuilder.startProcess("Hello World");
      builder.startActivity(new StartActivity()).initial().transition("hello display").endActivity();
      builder.startActivity("hello display", new Display("Hello")).transition("world display").endActivity();
      builder.startActivity("world display", new Display("World")).endActivity();
      ProcessDefinition processDefinition = builder.endProcess();

       

      The Display class implements ActivityBehaviour and pariculary does nothing.

       

      My setup is Spring 3.0, Spring jbpm integration, jbpm 4.2 via maven (from JBoss repository). I am looking for a way to deploy this small process, I have found several ways on wiki and forum which fail:

       

      http://docs.jboss.org/jbpm/pvm/manual/html_single/#d0e1870

       

      I donot have PvmDbSession class on my classpath (but for sure I do have pvm jars included!) + EnvironmentFactory is an interface.

       

      The question is how to deploy ProcessDefintion that has been built by ProcessDefintionBuilder?

       

      I have found also this:

       

      http://community.jboss.org/message/396133#396133

      Deployment deployment = processService.createDeployment();
      deployment.addObject("process", process);
      processService.deploy(deployment);

       

      but Deployment object does not have addObject method anymore.

       

      thanks in advance for any help

        • 1. Re: Does anyone know how to deploy ProcessDefintion in JBPM 4.2
          andriusms

          Hi,

           

          I'm not sure that it's possible to do this with only the jbpm4 library. Personally I've seen this kind of process definition construction only in jbpm4 tests. What you could do is start your constructed definition like this:

           

                  ClientProcessInstance processInstance = processDefinition.createProcessInstance();
                  processInstance.start();

           

          someone will correct me if I'm wrong, but I think the repository service with which you could deploy the process from an XML file doesn't seem to support process deployment from the definition object. To deploy the process from a file you can do this

           

                  ProcessEngine processEngine = new Configuration().setResource("your.jbpm.cfg.xml").buildProcessEngine();
                  RepositoryService repositoryService = processEngine.getRepositoryService();
                  NewDeployment deployment = repositoryService.createDeployment();
                  deployment.addResourceFromClasspath("process.jdpl.xml");       
                  deployment.deploy();

           

          I'm assuming the usage of JPDL language here. To deploy the process from the process definition builder you would need another step to convert that object into XML file that defines it, but I can't answer how to do that, because I never tried. Usually processes are pretty static so in most cases you should be able to create an XML file of the process and then you could deploy it.

          • 2. Re: Does anyone know how to deploy ProcessDefintion in JBPM 4.2
            tcr

            Hi,

             

            as already mentioned the deployment based on construction via ProcessDefinitionBuilder is not permanent. After deployment of a regular defintion (design in XML) the repository session will read the XML (which is then stored in DB) and parse it.

             

            The definition is not stored a objects but as XML. So without the XML you wont be able to have a proper definition.

             

            Regards

            Torsten