I have recently started using jBPM on a project.
The following is a snippet of the process defn I'm using:
<process-definition name="testWorkflow"> ... ... <state name="stateBeforeFork"> <event type="node-enter"> <action class="JustLeaveActionHandler" /> </event> <transition name="to_fork1" to="fork1"></transition> </state> <fork name="fork1"> <transition name="to_stateA" to="stateA"></transition> <transition name="to_taskA" to="taskA"></transition> </fork> <state name="stateA"> <event type="node-enter"> <action class="ExternalServiceActionHandler" /> </event> <transition name="to_join1" to="join1"></transition> </state> <task-node name="taskA"> <task swimlane="shipper"> <controller> <variable name="taskA Complete?" /> </controller> </task> <transition name="to_join1" to="join1"></transition> </task-node> <join name="join1"> <transition name="to_taskAfterJoin" to="taskAfterJoin"></transition> </join> <task-node name="taskAfterJoin"> <task swimlane="accountant"> <controller> <variable name="taskAfterJoin Complete?" /> </controller> </task> <transition name="to_endState" to="endState"></transition> </task-node> ... ... </process-definition>
The ExternalServiceHandler posts a JMS TextMessage (token id - in this case, the child token which
goes to stateA) onto a JBoss JMS topic. There is an MDB listening on the topic which does some processing,
loads the token (using the token id) and calls signal on it. The code below shows this:
... ... static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(); JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); GraphSession graphSession = jbpmContext.getGraphSession(); Token token = graphSession.loadToken(tokenId); System.out.println("Got the token : " + token.getFullName()); token.signal(); ... ...
I'm using the default webapp that comes with the starter kit to view the flow and interact with the above process.
The behavior I see is that after the MDB calls token.signal(), the debug messages show that process moves to join
(and assuming that task-node is marked complete using the webapp), and then moves to task-node "taskAfterJoin".
But the webapp monitoring piece contradicts this by showing that control is still at stateA.
Am I missing something here? If I take out the "post message to MDB and have MDB signal the token" and replace
it with a one line of code "executionContext.getNode().leave(executionContext)", it works great.
So I cannot understand why the webapp does not show what the debug messages are showing.
Do I have to save the process instance (or token) after calling signal in the MDB?
Do I need to save the process instance (or token) before posting a message in the Action Handler?
Any direction, solution or thoughts on this problem is appreciated.
Jboss AS: JBoss 4.0.4 GA w/ EJB3 support
jBPM: jBPM 3.1.1
OS: Windows XP
Copied the jbpm.sar folder (which has the jBPM jars) to the deploy directory of "all" server.
Created and copied a jbpm.ear which contains the jbpm.war (default webapp) and the MDB (in a jar) to the
deploy directory of "all" server.