cancel
Showing results for 
Search instead for 
Did you mean: 

Execution listener on end event?

unsavory
Champ on-the-rise
Champ on-the-rise
I need to have an execution listener defined on the end event of my process.  Something like this:
<endEvent id="abandoned">
         <extensionElements>
            <activiti:executionListener class="seah.bpm.qualification.UserStatusListener">
               <activiti:field name="status" stringValue="ABANDONED" />
               </activiti:executionListener>
               <activiti:executionListener class="seah.bpm.qualification.QualificationInactiveListener" />
         </extensionElements>
      </endEvent>

This is legal according to the schema, but it does not actually fire the listeners.  Is this a bug?  If not, how would one go about specifying listeners that can fire on the end event.  I call this end event from several different places within my process and need to always fire these listeners so do not want to specify them for each sequence flow.
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
You can add the listener one level up, under the process. That should work.

But your case should work to. Can you create a Jira + testcase?

aggiepilot04
Champ in-the-making
Champ in-the-making
I know this is an old thread, but I'm having a similar issue in 5.14.  I used the Eclipse designer to add the listener, and verified the generated BPMN (below).  Any ideas why this listener would not be fired?  My task listeners are working perfectly…just not the execution listener.  Thanks in advance.

<code>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="theProcess" name="The Process" isExecutable="true">
    <extensionElements>
      <activiti:executionListener event="end" class="package.WorkflowCompletionListener"></activiti:executionListener>
    </extensionElements>
….
</code>

martin_grofcik
Confirmed Champ
Confirmed Champ
Hello,

I tried the org.activiti.examples.bpmn.executionlistener.ExecutionListenerTest.testExecutionListenersOnAllPossibleElements()with small change

<process id="executionListenersProcess">
 
    <extensionElements>
      <activiti:executionListener class="org.activiti.examples.bpmn.executionlistener.ExampleExecutionListenerOne" event="start" />
    </extensionElements>

to end event.

<process id="executionListenersProcess">
 
    <extensionElements>
      <activiti:executionListener class="org.activiti.examples.bpmn.executionlistener.ExampleExecutionListenerOne" event="end" />
    </extensionElements>

It works. Could you create test case for it?

Regards
Martin

aggiepilot04
Champ in-the-making
Champ in-the-making
This turned out to be a problem with our process definition.  We had a requirement to unassign tasks that had been assigned for more than 24 hours, and this was implemented using a parallel gateway and a timer/script that fired every 24 hours (which is obviously a bad idea for a variety of reasons).  The parallel execution prevented the workflow from ever completing, and thus the listener was never being fired.  We'll have to set up a job elsewhere to meet the 'unassign expired tasks' requirement, but at least we have our listeners working now.

Thanks for the help.