Interface VoidCompletionCallback

All Superinterfaces:
org.mule.sdk.api.runtime.process.VoidCompletionCallback

@MinMuleVersion("4.1") @NoImplement public interface VoidCompletionCallback extends org.mule.sdk.api.runtime.process.VoidCompletionCallback
This callback is how Routers notify the end of its execution when no result is produced.

In order to implement a Void Router, the method needs to:

When the processing performed by the Router finishes, it has to notify its completion either by invoking the VoidCompletionCallback.success() or VoidCompletionCallback.error(Throwable) methods. Only then will the execution of the Router be considered as completed and the next processor in the pipeline will be executed.

For example, a Void Router can be declared as:


 public void enricher(WhenRoute when, @Optional DefaultRoute defaultRoute, VoidCompletionCallback callback) {
   if (when.shouldExecute()) {
     when.getChain().process(r -> callback.success(),
                             (e, r) -> callback.error(e));
   } else if (other != null && other.shouldExecute()) {
     other.getChain().process(r -> callback.success(),
                              (e, r) -> callback.error(e));
   } else {
     callback.error(new IllegalArgumentException("No route executed"));
   }
 }
 

As you can see, the result of the Route being executed is ignored, and the callback is notified with a VoidCompletionCallback.success() or VoidCompletionCallback.error(Throwable)

Since:
1.1
  • Method Summary

    Methods inherited from interface org.mule.sdk.api.runtime.process.VoidCompletionCallback

    error, success