All Superinterfaces:
org.mule.sdk.api.runtime.operation.FlowListener

@MinMuleVersion("4.1") @NoImplement public interface FlowListener extends org.mule.sdk.api.runtime.operation.FlowListener
Allows to execute custom logic when the flow on which an operation is being executed finishes.

Operation can declare an argument of this type and the runtime will automatically inject an implementation which the operation can use.

An example use case is an operation which needs to await for the owning flow to finish in order to execute some clean-up, or wants to know the final outcome in order to log it or audit it.

For example, let's see a very simple logging case


  public void listeningOperation(FlowListener listener) {
    listener.onSuccess(message -> LOGGER.debug("Response obtained", message.getPayload().getValue()));
    listener.onError(exception -> LOGGER.debug("Flow failed", exception));
    listener.onComplete(() -> doCleanUp());
    }
  }
 

Instances are not reusable and should not be cached. Instances are also not thread-safe. No instance should be used in a thread different from the one executing the operation.

Since:
1.0
  • Method Summary

    Methods inherited from interface org.mule.sdk.api.runtime.operation.FlowListener

    onComplete, onError, onSuccess