3 Replies Latest reply on Sep 10, 2011 10:14 PM by salaboy21

    Which class executes the graph

    tob1as

      Hi,

       

      in activiti, there is a class Execution.

       

      This class

      • keeps track of the current position of execution in a process flow during runtime (with a node pointer)
      • it knows how to interpret the process graph
      • it has a proceed method that takes the next transition, follows it up into the next destination node and invokes the node execution.

       

      Where would I find this logic in jBPM. ? Is this part of a process instance?

       

      I found this:

       

      ProcessInstance processInstance = ksession.startProcess("some.process");

      Returns the first node when a process is waiting:

      ((org.jbpm.workflow.instance.WorkflowProcessInstance)processInstance).getNodeInstances().iterator().next().getNodeName()

       

      So obviously the processInstance has knowledge about the current active nodes...

       

      Source: here

       

       

      Best regards,

       

      Tobias

        • 1. Re: Which class executes the graph
          salaboy21

          Exactly, but you need to know that jBPM5 is nodeInstance based and activiti is token based. So different mechanisms are being used to keep track of the process execution. Instead of the concept of token jBPM5 has this NodeInstances collection that contains the current nodes that are being executed.

          Cheers

          1 of 1 people found this helpful
          • 2. Re: Which class executes the graph
            tob1as

            Thanks Mauricio for your help,

             

            that means every nodeInstance knows the incoming and outgoing transition for the Node it was instantiated for and thereby invokes the execution of the next node itself?!

             

            I just had a look at the nodeInstance interface, which has a getNode() function.

             

            The Node interface then has a function getIncomingConnections() and getOutgoingConnections().

             

            I just tried to dig deeper into the source code, but I ve troubles finding the implementation of this.

             

            The api says that the inteface is in org.drools.runtime.process.

             

            I just cloned the git repo.

             

            Is this the right place to look for it?

            C:\git\jbpm\jbpm-flow\src\main\java\org\jbpm\process

            • 3. Re: Which class executes the graph
              salaboy21

              Hi Tobias,

              I have created a simple version of a node instance based core process engine to explain how jBPM5 works in the jBPM5 Developer guide.

              You can find the not finished source code here: https://github.com/Salaboy/Drools_jBPM5-Training-Examples/tree/master/jbpm5/07-jBPM5-NodeInstanceEngineSimpleImpl

              You can take a look at the tests to see what is happening. Obviously this is a simplified version of jBPM5 core, but it can help you to understand how it works.

              Cheers