JBoss Community

Issue with transitioning a task from an attached timer

created by Mukul Tandon in jBPM - View the full discussion

In jbpm 4.2, I am not able to transition a task out from a repeating timer which becomes active when the task is created. I want to monitor some external condition in that timer and when it is met, I want to complete the task because its no more needed. When I'm signalling the transition the task still remains active and the timer.notify() gets fired again after the current notify() is done.

I must not be using the timer or signalling the task correctly. Can anybody provide any input?

Thanks in advance.

 

Here's the code

 

 

 

 

<? xml version="1.0" encoding="UTF-8"?>

 

 

<process description="Timer Test Process" key="tt" name="TimerTest" xmlns="http://jbpm.org/4.0/jpdl">

 

<start g="328,116,48,48"> 

<transition g="-122,-18" to="Followup"/> 

</start>

 

<task g="284,230,169,52" name="Followup">

<on event="timeout" name="TimerEvent">

<timer duedate="10 minutes" repeat="1 minutes"/> 

<event-listener class="com.ubs.octane.workflow.bo.process.TestEventListener"/>

</on>

<transition g="-42,-18" name="Complete" to="Review"/>

</task> 

 

<task g="288,330,169,52" name="Review">

<transition g="-42,-18" name="Acknowledge" to="end"/>

<transition g="468,301:-70,8" name="Reject" to="Followup"/>

</task>

 

<end g="345,432,48,48" name="end"/>

</process>

 

 

 

public class TestEventListener implements EventListener {

protected int countCalled =0;

public void notify(EventListenerExecution execution) throws Exception {
  countCalled++;
  if(countCalled>=2){ //Will check some external condition here
         Application appInstance = Application.getApplicationInstance(UBSConstants.APPLICATION_NAME);
         ProcessEngine pe= (ProcessEngine)appInstance.getStaticData(WorkflowConstants.JBPM_PROCESS_ENGINE_INSTANCE);
         ExecutionService es =pe.getExecutionService();
         //This is not working
         es.signalExecutionById(execution.getId());   
         System.out.println("Done");
   }

}

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Reply to this message by going to Community

Start a new discussion in jBPM at Community