HandleInvocation method of DelegateInterceptor only executed once

Hello everyone,

I am trying to implement an interceptor that will be executed before and after each task execution. For that, I have implemented the interface DelegateInterceptor.

public class Foo implements DelegateInterceptor {

   public void handleInvocation(DelegateInvocation invocation) throws Exception {
      System.out.println("Foo.handleInvocation called");
      invocation.proceed();
   }
}

And I have changed the Process Engine configuration so that Foo class will be set as the default Delegate Interceptor.

@Override
public void postInit( ProcessEngineConfigurationImpl processEngineConfiguration ) {
    processEngineConfiguration.setDelegateInterceptor(new Foo());
}

I have noticed that the handleInvocation method of the interceptor is executed only once at the start of the process execution, can someone please tell me if this correct?

Thank you,

postInit(ProcessEngineConfigurationImpl processEngineConfiguration) function will be executed only once when the application is started and process engine bootstrapping was done.

1 Like

@aravindhrs thank you for your answer, I actually want to intercept the execution of all delegate methods (before the method execute of each Delegate is executed). I can do that locally on every method, but I would like to have it centralized and done by one element. Am I implementing the right interface?