8 Replies Latest reply on Aug 30, 2011 5:45 AM by npereira

    JBPM5 Starting Guvnor process question

    npereira

      Hi forum,

       

       

      My goal is for JBPM5 to orchestrate the process, but this process will be started by a foreign application. In this sense, I  would like the call Guvnor to start a process that his inside it's repository.

      How can I do this? Is there any examples available?

       

      Regards

        • 1. Re: JBPM5 Starting Guvnor process question
          bpmn2user

          Guvnor is mainly used for repository, i.e for storing and retrieving purposes. You typically start the process within your application runtime environment (or 'jbpm-gwt-console-server' which provides the runtime environment).

          1 of 1 people found this helpful
          • 2. JBPM5 Starting Guvnor process question
            npereira

            Hi bpmn2user,

             

            Thanks for you reply.

            In that sense, I was looking into start'ing processes in the 'jbpm-gwt-console-server' runtime enviorment.

             

            Are there any example i might look at?

             

            Regards

            • 3. Re: JBPM5 Starting Guvnor process question
              npereira

              Hi forum,

               

              I'm still having some dificulty with his question, I was wondering if someone could help.

               

              What we are trying to implement is a startProcess() method.

              The objective of this method is to contact the runtime engine and “tell it” to start a given process, without using REST.

               

              So far we have gotten to these point.

               

              KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();

              KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("testKAgent", aconf);    

              String fileName = "/home/n1w3/Downloads/ChangeSet.xml";

              kagent.applyChangeSet(ResourceFactory.newFileResource(fileName));

              KnowledgeBase kbase = kagent.getKnowledgeBase();

               

              StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

              Collection<ProcessInstance> c = ksession.getProcessInstances();

               

              System.out.println(c.size());

              kbase = kagent.getKnowledgeBase();

              for (Process process: kbase.getProcesses()) {

              System.out.println("Loading process from Guvnor: " + process.getId());

              }

               

                ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());

              //StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();           

              ProcessInstance processInstance = ksession.startProcess("com.temenos.bpmn.CustomerOnBoarding");

               

              System.out.println(processInstance.getId());

               

              These peace of code, lets us fetch the processes that are in guvnor and then start a new process.

              The problem with it, is that I have to maintain my session open so that the process gets orchestrated. If I stop the program, the process does not get orchestrated.

               

              The objective we are trying to obtain is something like a “fire and forget” approach where we say start process and the runtime engine ('jbpm-gwt-console-server') orchestrates it.

               

              Can anybody help us out with this one?

              • 4. Re: JBPM5 Starting Guvnor process question
                npereira

                Hi forum,

                 

                Can anybody help me with this question?

                Would really apreciate it! Even if I'm going all wrong with my approach, I would really apreciate other solutions.

                 

                Thanks in advanced.

                 

                Regards

                • 5. Re: JBPM5 Starting Guvnor process question
                  melc

                  Hello,

                  The processes that you create are stored in Guvnor repository. These processes have to be accessed and started, as a result orchestrated, by the jbpm engine. You have two choices,

                  1. Use your own instance of the engine with your own configuration etc ( for example the code you have posted).

                  2. Use 'jbpm-gwt-console-server, which is a web application having all code and configurations needed for the jbpm engine to run.

                   

                  I understand that whatever the approach, you want a "fire and forget" solution. Such a solution is achieved by running an application as a service (i.e. run constantly and listen on a port of your system - not very nice) or as a server (i.e. create web application and deploy on an application server like jboss - then you have to use http calls to communicate with it - i.e. web services).

                  Approach 2 above is ready out of the box (you have the engine running on a server and the communication methods - REST API - ready for you)  and you have to communicate via REST.

                   

                  p.s. whatever the approach you will be getting all your definitions and resources from the repository of Guvnor. And of course with Guvnor  you can make any modifications etc to your processes in real time without redeploying and restarting your engine.

                  • 6. Re: JBPM5 Starting Guvnor process question
                    eaa

                    IIRC, jbm-gwt-console has some kind of REST WS API that I think you can use to start your processes there.

                    1 of 1 people found this helpful
                    • 7. Re: JBPM5 Starting Guvnor process question
                      tsurdilovic

                      If you have jbpm-console running, navigate to http://localhost:8080/gwt-console-server/rs/server/resources to see the list of all exposed rest interfaces.

                       

                      Hope this helps.

                      • 8. Re: JBPM5 Starting Guvnor process question
                        npereira

                        Hi Guys,

                         

                        Thank you very much for all the replies.

                        I will be looking into the REST framework to achieve this.

                         

                        Regards