Monitoring Process Execution

The Infinity Process Platform provides the Service Provider Interface IProcessExecutionMonitor to monitor process execution. Please refer to the according JavaDoc IProcessExecutionMonitor for detailed information on the interface.

package org.eclipse.stardust.engine.core.spi.monitoring;

import org.eclipse.stardust.common.annotations.SPI;

import org.eclipse.stardust.common.annotations.Status;
import org.eclipse.stardust.common.annotations.UseRestriction;
import org.eclipse.stardust.engine.core.runtime.beans.IProcessInstance;

@SPI(useRestriction = UseRestriction.Public, status = Status.Stable)
public interface IProcessExecutionMonitor
   void processStarted(IProcessInstance process);

   void processCompleted(IProcessInstance process);

   void processAborted(IProcessInstance process);

   void processInterrupted(IProcessInstance process);

The interface has several methods for propagating process execution states:

Creating a custom Implementation

To implement the IProcessExecutionMonitor interface and publish the implementation to the engine, a file named by the interface's factory has to be created in the /META-INF/services folder of the jar. Perform the following steps:

  1. Implement the interface as shown below
  2. Create a text file named org.eclipse.stardust.engine.core.spi.monitoring.IProcessExecutionMonitor. The file contents needs to be the fully qualified name of your implementation class, e.g. org.eclipse.stardust.example.ProcessExecutionMonitorImpl.
  3. Place the file into the META-INF/services folder of the jar that will contain your implementation class
package org.eclipse.stardust.example;

import org.eclipse.stardust.engine.core.runtime.beans.IProcessInstance;
import org.eclipse.stardust.engine.core.spi.monitoring.IProcessExecutionMonitor;

public class ProcessExecutionMonitorImpl implements IProcessExecutionMonitor {

   public void processStarted(IProcessInstance process) {

   public void processCompleted(IProcessInstance process) {

   public void processAborted(IProcessInstance process) {

   public void processInterrupted(IProcessInstance process) {


Accessing Information from the same Transaction

A process execution monitor implementation is called in the same transaction of the previously executed activity thread. If you like to publish the last performed activity in the process, it might not have been committed yet and possibly cannot be fetched.

In that case, you could look up the activity instance cache (thread local) to get the activity instances that have been created as part of the currently running transaction. The code should look similar as the following:

Session session = (Session) PropertyLayerProviderInterceptor.getCurrent().getAuditTrailSession();
Collection cache = session.getCache(ActivityInstanceBean.class);
for (Iterator i = cache.iterator(); i.hasNext();) {
ActivityInstanceBean ai = (ActivityInstanceBean) ((DefaultPersistenceController);

Please note that, if the cache does not contain any activity instance you would still have to look what has been persisted so far by using the following method:


The above code is not part of our public API, but it can be considered to be a very stable internal API. Please take in account that implementation details might change.

Retrieving Custom Spring Beans from the Monitor Implementation Class

To retrieve custom Spring beans from the Monitor implementation class, you can use method getApplicationContext of the SpringUtils class.

It returns the context bootstrapped by IPP containing the Spring beans.

   private ApplicationContext appContext;
   appContext = SpringUtils.getApplicationContext();
   if (null == appContext)
      throw new PublicException("No Spring application context available.");
   serviceBean = appContext.getBean(SpringBeanName(), type);