2 Replies Latest reply on Jan 15, 2010 4:30 AM by supermp

    jbpm 4 task problem

      Hi everybody,

      i'm trying to migrate my process from 3.2.1 to 4.3;

       

      In jbpm 3.1.2 i had an action on a transition that send an email with the current task ID in its body;

      now in jbpm 4.3 i have this task:

       

      <task assignee="peter" form="review.ftl" g="241,85,80,40" name="readyToStart">
            <on event="start">
          <event-listener class="com.jbpm.utils.test">    
            </event-listener>
         </on>
            <transition g="-43,-18" name="to fork1" to="task1"/>
         </task>

       

      and in the class test:

       

      public class test implements EventListener{

       

          public void notify(EventListenerExecution execution) throws Exception {
          ProcessEngine eng=    Configuration.getProcessEngine();
          String process=execution.getProcessInstance().getId();
        
              Task t=eng.getTaskService().createTaskQuery().processInstanceId(process).uniqueResult();
              t.getId();
              System.err.println(t.getAssignee());
              System.err.println(t.getId());
              System.err.println(t.getExecutionId());
          }

       

      }

       

      but the task-id is not the "current task"-id but the previous task-id.

       

      It seems that the eventlistener is fired before that in the database the current Task is updated ,

      so i get the previous task-id.

       

      There is a way to get the task-id of the current task?

       

       

      Massimo

        • 1. Re: jbpm 4 task problem
          saraswati.santanu

          Not that I know of.

           

          The following things happen in sequence when transition happens from one activity to another

           

          1. End event fires for the source node
          2. Destination activity is set on the execution
          3. Start event is fired on the destination node
          4. execute method of destination activity behaviour is called

           

          For a task node, the task is saved in db at step 4, and you expecting the id in step 3. Hence problem.

           

          There is a bug logged already: https://jira.jboss.org/jira/browse/JBPM-2644

          1 of 1 people found this helpful
          • 2. Re: jbpm 4 task problem

            Thank you,

            I'll wait for the bug fixing, meanwhile

            in your opinion exists a workaround for this behaviour?

             

            How can i get the current task id?

             

            Massimo