@NoImplement public interface 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 success()
or 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 success()
or error(Throwable)
Modifier and Type | Method and Description |
---|---|
void |
error(Throwable e)
This method is to be invoked when the Router execution ends with an error.
|
void |
success()
This method is to be invoked when the Router execution is completed successfully
|
void success()
void error(Throwable e)
e
- the exception foundCopyright © 2018. All rights reserved.