@MinMuleVersion(value="4.1")
@NoImplement
public interface VoidCompletionCallback
extends org.mule.sdk.api.runtime.process.VoidCompletionCallback
In order to implement a Void Router, the method needs to:
Route typeVoidCompletionCallback type
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)
Copyright © 2025 MuleSoft, Inc.. All rights reserved.