AnsweredAssumed Answered

Options for Lifecycle Event Listeners / Interceptors

Question asked by jjfutt on Mar 22, 2012
Latest reply on Mar 27, 2012 by damokles
Hello:

This is a continuation of my questions from a previous thread (now closed http://forums.activiti.org/en/viewtopic.php?f=6&t=3691) regarding the options for implementing Lifecycle Event listeners.

Our Objective: Implement Java listeners that can do 'stuff' when events such as Process started, completed, execution taken etc occur. Ideally, we want to do this without having to code the listeners in the process (something similar to to Aspect Oriented Programming, where we could configure events and observers external to the process definition).

Our Execution Environment: We'll be running the Activiti engine in NON-JAVAEE containers (Tomcat, standalone JVMs, Mule)

Our Process Engine Configuration: We' have had success with both StandaloneProcessEngineConfiguration and SpringProcessEngineConfiguration

Based on the information provided in the user guide and the ActivitiInAction book, I have narrowed down the following options for implementing event listeners. I'd appreciate if somebody could verify /and/or answer the questions below:

  • Option 1: Implement Task Listeners within the Process Definition itself (doable of course, but not desired in our case because it requires explicit coding)

  • Option 2: Use the 'Activiti-CDI' module – either in a JEE container that provides CDI (JSR299/JSR330?) implementation, or use a CDI implementation such as 'WELD' for deployment in a non-JavaEE container. In these configurations, the user guide describes the use of @Observer annotation to listen to lifecycle events.
Questions:
  • Q1: Are the above mentioned methods the only two options for listening to Lifecycle events? Is there any other interceptor/events mechanism that can be leveraged? Is there a way to leverage Spring AOP on process lifecycle events?

  • Q2: Is WELD the only option to to use in non-Java-EE enviornments? If we are using SpringProcessEngineConfiguration, does it open any doors to any spring oriented options?
Thanks in advance.

Outcomes