cancel
Showing results for 
Search instead for 
Did you mean: 

taskListener not getting called

prasath
Champ in-the-making
Champ in-the-making
Hi,

I am trying to call taskListener method from my user task on the event of event complete. but that listner method is not getting invoked at all.

This is me user task
        <bpmn:userTask implementation="##unspecified" isForCompensation="false" startQuantity="1" completionQuantity="1" name="Handle vacation request" id="handleRequest" formKey="dynamic_1" assignee="${assignee}" candidateGroups="management,lt,lt-1">
            <bpmn:documentation textFormat="text/plain">${employeeName} would like to take ${numberOfDays} day(s) of vacation (Motivation: ${vacationMotivation}).</bpmn:documentation>
            <bpmn:extensionElements>
                <activiti:formProperty id="vacationApproved" name="Do you approve this vacation" required="true" type="enum" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                    <activiti:value id="true" name="Approve"/>
                    <activiti:value id="false" name="Reject"/>
        </activiti:formProperty>
                <activiti:formProperty id="managerMotivation" name="Motivation" type="string" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:xsd="http://www.w3.org/2001/XMLSchema'/>
                <activiti:taskListener event="complete" class="$com.testapp.testsignoff.service.CaptureListenerr" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:xsd="http://www.w3.org/2001/XMLSchema'/>
                <jbpmnSmiley FrustratedhapeDesign>{"outer":{"background":{"startColor":"RGB(255,255,255)","endColor":"RGB(226,232,236)"},"border":{"color":"RGB(108,142,183)","width":2.5}},"inner":{"background":{"startColor":"RGB(255,255,255)","endColor":"RGB(255,248,159)"},"border":{"color":"RGB(30,69,123)","width":1.0}}}</jbpmnSmiley FrustratedhapeDesign>
            </bpmn:extensionElements>
            <bpmn:incoming>flow7</bpmn:incoming>
            <bpmn:incoming>flow10</bpmn:incoming>
            <bpmnSmiley Surprisedutgoing>flow2</bpmnSmiley Surprisedutgoing>
            <bpmn:multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${assigneeList}" activiti:elementVariable="assignee" xmlns:activiti="http://activiti.org/bpmn'/>
        </bpmn:userTask>



and this is my class….


package com.testapp.testsignoff.service;

import org.activiti.engine.delegate.TaskListener;
import  org.activiti.engine.delegate.DelegateTask;
import  org.activiti.engine.delegate.DelegateExecution;
public class CaptureListenerr implements TaskListener {

   @Override
   public void notify(DelegateTask task) {
            // Pass the values we get back to the workflow
            DelegateExecution execution = task.getExecution();   
                                System.out.println("inside capture listner");
            execution.setVariable("apcwf_someId", task.getVariable("apcwf_someId"));
            execution.setVariable("apcwf_someText", task.getVariable("apcwf_sometext"));
   
        }
}
1 REPLY 1

vasile_dirla
Star Contributor
Star Contributor
Hi,
It should work I tried to reproduce it but I wasn't able to reproduce it.
Could you give some more details about your Activiti version and maybe you have something relevant into your log file ?

Would be great if you will post also your bpmn xml file.