1 Reply Latest reply on Sep 16, 2005 5:29 PM by mdonato

    newbie question

    jsanmarco

      Hi all, I'm doing some test and trying to get the picture of jBPM.
      I have this processDefinition:

      <process-definition name="simple">
       <start-state name="start">
       <task>
       <controller>
       <variable name="color" />
       <variable name="size" />
       </controller>
       </task>
       <transition name="toT1" to="task1"></transition>
       </start-state>
       <end-state name="end"></end-state>
       <node name="task1">
       <action name="action1" class="com.lumina.jbpm.tasks.Task1"></action>
       <transition name="toFork" to="fork1"></transition>
       </node>
       <fork name="fork1">
       <transition name="toT2" to="task2"></transition>
       <transition name="toWaitState" to="esperar"></transition>
       </fork>
       <state name="esperar">
       <action name="action3" class="com.lumina.jbpm.tasks.DummyAction"></action>
       <transition name="toJoin1" to="join1"></transition>
       </state>
       <node name="task2">
       <action name="action2" class="com.lumina.jbpm.tasks.Task2"></action>
       <transition name="toJoin1" to="join1"></transition>
       </node>
       <join name="join1">
       <transition name="toT4" to="task4"></transition>
       </join>
       <node name="task4">
       <action class="com.lumina.jbpm.tasks.Task4"></action>
       <transition name="toEnd" to="end"></transition>
       </node>
      </process-definition>
      


      Each of the com.lumina.jbpm.tasks.Task* perform basically the same stuff, they print a string and call executionContext.leaveNode(). The class com.lumina.jbpm.tasks.DummyAction only prints a string (no leaveNode is done)

      The point is, after forking, 'action2' and 'action3' are executed. At this time I have the state node named 'esperar' in a wait state (waiting for an external event to arrive). Here I make the controller class, the one that started the execution and manages processInstances persistence (delegating on jBPM classes), to persist the instance state and finish. Later, when the external event arrives, the controller class loads the processInstance to continue the execution. To do this, the class performs a processInstance.signal(). The unexpected result (unless for me) is the execution of 'action2' (again) but nothing happens with the state node 'esperar'. What I was expecting was the opposite, I mean, I thought that the call to signal would affect only the state node to continue to the join node because the node 'task2' (which contains the 'action2' action) was already executed in the first step before persisting the workflow state.

      What am I missing?

      Thanks in advance,

      Juan Manuel

      PS: sorry for my english