4 Replies Latest reply on Jun 17, 2010 5:50 AM by Jaber C. Mourad

    How to get current task in EventListener ?

    Jaber C. Mourad Novice



      I'm doing some experiments with jbpm 4.4 snapshot.


      I have a trouble in an EventListener which was working with jbpm 4.3.


      My code :

          public void notify(EventListenerExecution execution) throws Exception {
              Task task = taskService.createTaskQuery().processInstanceId(execution.getProcessInstance().getId()).uniqueResult();
              if (task == null) {
                  logger.warn("No task found for ProcessInstance {}", execution.getProcessInstance().getId());
              } else {
                  logger.trace("task name {} ; assignee ", task.getName(),task.getAssignee());
                  execution.createVariable(LAST_TASK_ASSIGNEE, task.getAssignee());


      Is there a better way to get the current task in a event listener or it is a bug in the trunk ?