AnsweredAssumed Answered

Activiti CDI and Execution Listener

Question asked by se040 on Nov 20, 2012
Latest reply on Nov 23, 2012 by se040
Hi again,

having another issue :) This time I changed to the CdiJtaProcessEngineConfiguration for using CDI and JTA (obviously ;)) and I am facing an issue with the execution listener, which worked fine before using that kind of engine. I have implemented a class to catch a process end event but since the change it doesn't seem to be invoked anymore. I tried various things to get to a solution, including using class/expression/delegateexpression variants for this purpose, implemented listeners of sequence flow and start event with same result and I tried using the configuration from the book Activiti in Action (beans.xml changes for interceptors + additional property customPostBPMNParseListeners on my config). Nothing seems to work for me, the process finishes and however the configuration or type of invocation nothing happens. Is this normal and I have to use CDI Event Listening? I tried that but since I am not an expert on JEE I wasn't sure how to do it and research didn't help (I used the configuration from the camunda site and implemented a method catching all events in a new / unrelated SessionScoped bean method and it also never got invoked).

Since I don't have any exceptions, cause it all basically works, I don't know what more information I can provide.

Things I tried:

      <activiti:executionListener event="end" delegateExpression="${processOneEndListener}"></activiti:executionListener> –> processOneEndListener (@Named) has method required: public void notify(DelegateExecution execution) throws Exception
      <activiti:executionListener event="end" expression="${processOneEndListener.testMe(execution)}"></activiti:executionListener> –> processOneEndListener also @Named


<bean id="processEngineConfiguration" class="org.activiti.cdi.CdiJtaProcessEngineConfiguration">
      <property name="dataSourceJndiName" value="jdbc/MyActiviti" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="history" value="full" />
      <!– using externally managed transactions –>
      <property name="transactionsExternallyManaged" value="true" />
      <property name="databaseSchemaUpdate" value="true" />
      <property name="jobExecutorActivate" value="true" /> // also tried false since i wasn't sure how i had it before
      <property name="customPostBPMNParseListeners">
            <bean class="org.activiti.cdi.impl.event.CdiEventSupportBpmnParseListener" />



I would really appreciate it if someone could help me and look into this or generally could give me an idea how to implement the following logic: I want to use an end event listener to change the data state of entity entries in a database created in the process. While the process is still active all data has no valid date (null for that time) and i store information about Tables/Entities used in process in a process variable. All my entities have a field for the process id so i can easily retrieve them. For example in my process i create and persist a book entity. It has a name, id, valid date (Timestamp) and a processinstanceid. So when first saving it in the process all fields are filled but the valid date. This should be updated at process end.

Thanks in advance,