Execution listeners for process instance start/end in Camunda modeler

Hi there,

In your documentation on process listeners, I noticed a sample of setting process instance execution listeners on start event:


 
    
      
    

    

    

    

    
      
        
          
            println execution.eventName
          
        
      
    

    
      
        
      
    

    

    

    

    
  

However, in the Camunda modeler, there is no way of adding listeners on process instance start, but only on start event itself. I assume that by manually adding to the process the fragment below, it will trigger the listener on process instance start.


      
    

Attaching the listener to start event item, would produce the extension under the start event tag, which is not the same as above, where extension is directly under

 tag
    
        
        
        
        
      
      
    

Cristian

Hi Cristian,

this feature comes with the new version 1.2 of the camunda modeler which was build yesterday. You can already download it from our repository.
Enjoy!

Best regards,
Philipp

1 Like

Thank you, Phillip. Good to know! All the best.

Hi @Philipp_Ossler,

I’ve configured a custom listener to trigger Process Instance Start Event using a listener as process engine plugin

it works fine but works for both tasks and executions
I need to “restrict” to only start process instance event preferably after creation, to perform some operations

Can you help me, please?

thanks in advance

Solved overriding the parseProcess method:

public class MyEventParseListenerextends ProcessApplicationEventParseListener {
	public final static ExecutionListener EXECUTION_LISTENER = new MyEventParseListener();

	@Override
	public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
		processDefinition.addListener(ExecutionListener.EVENTNAME_START, EXECUTION_LISTENER);
		processDefinition.addListener(ExecutionListener.EVENTNAME_END, EXECUTION_LISTENER);
	}
}

best regards

1 Like