Community

How to get current task in EventListener ?

created by Jaber C. Mourad in jBPM - View the full discussion

Hi,

 

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 :

    @Override
    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 ?

 

Regards

Reply to this message by going to Community

Start a new discussion in jBPM at Community