0 Replies Latest reply on Sep 10, 2009 8:05 AM by prajatna

    Timer is not working

      Hi,
      I have designed a timer with a task node. simply it should print a message after the given duedate i.e 20 seconds. the code is as follows..

      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="newTravelProcess">
      
       <start-state name="start">
       <transition to="PM: Approval" name="for PM approval"></transition>
       </start-state>
      
       <task-node name="PM: Approval">
       <task name="waitForPMApproval">
       <description>
       Waiting for the PM to approve the request
       </description>
       <assignment class="com.sample.action.NodeAssignAction"></assignment>
       </task>
       <timer duedate="20 seconds">
       <action class="com.sample.action.TimerAction" name="ReminderAction"></action>
       </timer>
       <transition to="approveRequest" name="approvedByPM"></transition>
       <transition to="Booking Rejected" name="PM_rejected"></transition>
       </task-node>


      So, here as per the document it should create the Timer on entry of this task node, and should execute the timer action after 20 seconds..

      My problem is that the timer is creating , but after 20 sec , nothing is happening...

      Below is the code for TimerAction
      public class TimerAction implements ActionHandler {
      
       private static Log log = LogFactory.getLog(TimerAction.class);
       public void execute(ExecutionContext executionContext) throws Exception {
      
       log.debug("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
       log.debug("Please approve the request ASAP");
       log.debug(executionContext.getNode().getName());
       }
      
      }


      and here how i am calling my process from inside a java class
      JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
      
       //-------------- Extract a process definition from the processdefinition.xml file.----------
       ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("simple/processdefinition.xml");
       jbpmContext.deployProcessDefinition(processDefinition);
      
      
       //--------------- Extracting process from DB with process name -----------------
      
       String processName = "newTravelProcess";
       GraphSession graphSession = jbpmContext.getGraphSession();
       processDefinition = graphSession.findLatestProcessDefinition(processName);
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
      
       //--------------- Create and start the Process execution with Token -----------------
       Token token = processInstance.getRootToken();
      
       log.debug("...Node is....." + token.getNode().getName());
       token.signal();
      



      Can you please suggest , why the timer is not executing after 20 sec...
      I am using JBPM 3.2.2

      also find below the logs
      17:16:42,412 [main] DEBUG TravelTester : ...Node is.....start
      17:16:42,412 [main] DEBUG GraphElement : event 'before-signal' on 'StartState(start)' for 'Token(/)'
      17:16:42,412 [main] DEBUG GraphElement : event 'node-leave' on 'StartState(start)' for 'Token(/)'
      17:16:42,412 [main] DEBUG GraphElement : event 'transition' on 'Transition(for PM approval)' for 'Token(/)'
      17:16:42,412 [main] DEBUG GraphElement : event 'node-enter' on 'TaskNode(PM: Approval)' for 'Token(/)'
      17:16:42,412 [main] DEBUG GraphElement : executing action 'CreateTimerAction(15c97e4)'
      17:16:42,412 [main] DEBUG Token : token[3110] is locked by token[3110]
      17:16:42,422 [main] DEBUG GraphElement : event 'timer-create' on 'TaskNode(PM: Approval)' for 'Token(/)'
      17:16:42,432 [main] DEBUG Token : token[3110] is unlocked by token[3110]
      17:16:42,442 [main] DEBUG GraphElement : event 'task-create' on 'Task(waitForPMApproval)' for 'Token(/)'
      17:16:42,442 [main] DEBUG NodeAssignAction : This Node is-------PM: Approval
      17:16:42,442 [main] DEBUG NodeAssignAction : Current TaskId-----3453
      17:16:42,442 [main] DEBUG GraphElement : event 'after-signal' on 'StartState(start)' for 'Token(/)'
      17:16:42,442 [main] DEBUG TravelTester : ...Node after signal is .....PM: Approval