3 Replies Latest reply on Apr 2, 2008 3:06 AM by gar jar

    Start process from code

    gar jar Newbie

      Hi.
      Somebody can tell me how can I start process from code, not from jbpm-console?, or where can I find tutorial or examples?

      I have process definition deployed and running on server.
      I have a webservice that receive variables, and I want to start process when ws is executed.

      Thanks.

        • 1. Re: Start process from code
          gar jar Newbie

          I've tried whit this code and runs ok

          ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
          "<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='TestStart'>" +
          
          [.....PROCESS DEFINITION...]
          
          "</process-definition>"
          );
          
          ProcessInstance processInstance = new ProcessInstance(processDefinition);
          
           Token token = processInstance.getRootToken();
           token.signal();
          
          


          Now the process start and moves to node ok, but don't persist on db.
          Any sugestion?

          • 2. Re: Start process from code
            gar jar Newbie

            I've tried whit this code and runs ok

            ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
            "<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='TestStart'>" +
            
            [.....PROCESS DEFINITION...]
            
            "</process-definition>"
            );
            
            ProcessInstance processInstance = new ProcessInstance(processDefinition);
            
             Token token = processInstance.getRootToken();
             token.signal();
            
            


            Now the process start and moves to node ok, but don't persist on db.
            Any sugestion?

            • 3. Re: Start process from code
              gar jar Newbie

              I forget to change hibernate.cfg.xml when I deployed :p

              Now runs ok an persist on db thanks!