EventListener configuration

Hi,
I believe I found a slightly difference in the configuration of event listeners done via processEngineConfiguration whether on process models XMLs.

If I operate something like:

<property name="typedEventListeners">    
  <map>        
    <entry key="JOB_EXECUTION_FAILURE" >            
      <list>                
        <bean class="com.playground.MyListener"/>            
      </list>
    </entry>
  </map>
</property>

I cannot have MyListener to be CDI aware, all @Inject annotations will be null objects.

But if I put:

<flowable:eventListener events=“JOB_EXECUTION_FAILURE” delegateExpression="${myListener}"></flowable:eventListener>

in every process model, since I’m using delegateExpression, it will work.

The downside is that it would require editing for all existing process models.

Is there a way to use “delegateExpression” for <bean class in the processEngineConfiguration aswell?

Moreover: I already have a “startExecutionListener” in any of my processes, it would be the same to have this API usage:

void addEventListener(FlowableEventListener listenerToAdd, FlowableEventType… types);

in the listener I’m already invoking on that execution listener?

Thanks for any suggestion! :wink:

Summary

This text will be hidden

How are you using Flowable in CDI? If you’re creating the engine programmatically, you could set the CDI-aware beans on the processEngineConfiguration directly (and they would have all dependencies injected).

Hi Joram,
I’m actually using a custom “com.playground.CdiJtaProcessEngineConfiguration” extending the default CdiJtaProcessEngineConfiguration because I’m overriding in it the transaction manager related methods.

I’m fully CDI aware when executing custom Service Tasks (since they’re declared as delegate in the process definition) and same goes for my process defined ExecutionListeners (onStart and onComplete) but I cannot get an EventListener to be CDI aware if I define it in the flowable.cfg.xml, I managed to do it by injecting a programmatical EventListener in every process flow design, but doing that only in the process engine cfg file would be better since I would not have the issue of modifying any existing process flow in Design app.

Cheers, thanks.

(See you on friday, btw, yay!)