3 Replies Latest reply on Dec 29, 2005 4:15 PM by Ian Terrell

    Create timer problem coming from completed task

    Ian Terrell Newbie

      I'm experimenting with jBPM before integrating it into my application, and I've run into a small snag.

      My original process went like this:

      <process-definition name="myProcess">
       <swimlane name="myLane">
       <assignment class="com.example.MyAssignmentHandler" />
       <start-state name="start">
       <transition name="go" to="call" />
       <state name="call">
       <transition name="go" to="wait" />
       <transition name="done" to="end" />
       <state name="wait">
       <timer duedate="10 seconds" transition="go" />
       <transition name="go" to="fax" />
       <state name="fax">
       <transition name="go" to="end" />
       <end-state name="end" />

      And it worked fine. Advancing from "call" went to "wait," and 10 seconds later it went to "fax." But, I wanted to make call a task-node that would advance after the task was done. So I changed the state "call" to

       <task-node name="call">
       <task name="phonecall" swimlane="myLane" />
       <transition name="go" to="wait" />
       <transition name="done" to="end" />

      After the completion of the task the process successfully moved to the state "wait." However, it does not create a timer upon entry, and thus does not automatically advance to "fax."

      I noticed from the log that despite not creating the timer, it was at least firing the event "node-enter" on "wait," so I replaced the state "wait" with the following

       <state name="wait">
       <transition name="go" to="fax" />
       <event type="node-enter">
       <create-timer duedate="10 seconds" transition="go" />

      Now the event is being executed, as seen in the log

      DEBUG [GraphElement] executing action 'CreateTimerAction(...)'

      however, the SchedulerThread is not finding the timer.

      I'm developing a simple web application using the SchedulerServlet and the service jbpm.sar provided in the 3.0.2 starter kit, and using servlets to interact with jBPM.

      My task servlet looks like:

      package ...;
      import ...;
      public class DoTask extends HttpServlet {
       protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       String action = (String)request.getParameter("action");
       long id = Long.parseLong(request.getParameter("id"));
       JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.getInstance();
       JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();
       TaskInstance task = jbpmSession.getTaskMgmtSession().loadTaskInstance(id);
       if ("called".equals(action))
       else if ("paid".equals(action))

      Any ideas why my timer isn't getting created, or at least, not found?

      Is the SchedulerServlet the best place for a scheduler in a full blown J2EE application with all of the business (and thus jBPM) logic in Session EJBs?

      Thanks for your help,