[jbpm-users] [JBoss jBPM] - Action not executing in timer

oravecz do-not-reply at jboss.com
Sun Oct 12 03:23:30 EDT 2008


I am having some trouble getting a workflow to function the way I want it to. I have stripped it down to a very simple example.

I have a node that will attempt to process a credit card. If it fails to communicate to the server I would like it to pause for a couple minutes, then try again. This example is bare bones and node1 represents the initial attempt anf state1 represents a delay. After the delay, the next node will eventually be a node that retries the communication, but for now it simply ends.


  | <process-definition xmlns="" name="examplePause">
  | 	<start-state name="startPauseExample">
  | 		<transition to="node1"></transition>
  | 	</start-state>
  | 
  | 	<node name="node1">
  | 		<script>
  | 			System.out.println("Node: " + node);
  | 			token.signal();
  | 		</script>
  | 		<transition to="state1"></transition>
  | 	</node>
  | 
  | 	<state name="state1">
  | 		<script>
  | 			System.out.println("Node: " + node);
  | 		</script>
  | 		<timer name="timer1" duedate="10 seconds" transition="end" cancel-event="node-left">
  | 			<script>
  | 				System.out.println("Timer executed.");
  | 				token.signal();
  | 			</script>
  | 		</timer>
  | 		<transition to="endPauseExample" name="end"></transition>
  | 	</state>
  | 
  | 
  | 	<end-state name="endPauseExample"></end-state>
  | </process-definition>
  | 

My unit test executes the workflow by calling getRootToken.signal(). It then sleeps for 15 seconds. At the end of 15 seconds, I was hoping that the timer would of fired and I would transition to the next node (the end state). But when the 15 seconds ends, the token is still in 'state1'.

I'm not sure if the following logs show the appropriate steps, but the major players seem to be there:


  | [org.jbpm.graph.def.GraphElement]  - event 'process-start' on 'ProcessDefinition(examplePause)' for 
  |                                      'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - event 'before-signal' on 'StartState(startPauseExample)' for 
  |                                      'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - event 'node-leave' on 'StartState(startPauseExample)' for 
  |                                      'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - event 'transition' on 'Transition(7857a5)' for 'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - event 'node-enter' on 'Node(node1)' for 'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - executing action 'Script(19deddb)'
  | [org.jbpm.graph.def.GraphElement]  - event 'before-signal' on 'Node(node1)' for 'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - event 'node-leave' on 'Node(node1)' for 'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - event 'transition' on 'Transition(3744bc)' for 'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - event 'node-enter' on 'State(state1)' for 'Token(/)'
  | [org.jbpm.graph.def.GraphElement]  - executing action 'CreateTimerAction(8032df)'
  | [org.jbpm.graph.def.GraphElement]  - event 'timer-create' on 'State(state1)' for 'Token(/)'
  | I see the database insert statement...
  | [org.jbpm.graph.def.GraphElement]  - event 'after-signal' on 'Node(node1)' for 'Token(/)'
  | [   org.jbpm.graph.action.Script]  - script output: {}
  | [org.jbpm.graph.def.GraphElement]  - event 'after-signal' on 'StartState(startPauseExample)' for 
  |                                      'Token(/)'
  | I see the job being pulled from the database by the JobExecutor...
  | [   org.hibernate.pretty.Printer]  - org.jbpm.job.Timer{isExclusive=false, lockTime=null, 
  |                                      isSuspended=false, exception=null, 
  |                                      graphElement=org.jbpm.graph.node.State#18, 
  |                                      processInstance=org.jbpm.graph.exe.ProcessInstance#1, 
  |                                      repeat=null, version=0, id=1, lockOwner=null, 
  |                                      token=org.jbpm.graph.exe.Token#1, name=timer1,
  |                                      action=org.jbpm.graph.def.Action#20, retries=1, 
  |                                      dueDate=2008-10-12 02:56:25, transitionName=end, 
  |                                      taskInstance=null}
  | 

The database record references the correct action in the database (System.out.println("Timer executed...) but the action is never initiated.

Any ideas what I might try? Is the jpdl correct for what I intend to do?

Thanks.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181669#4181669

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181669



More information about the jbpm-users mailing list