Suppose we have a certain function (and it cannot be changed):
void action(Consumer<Result> callback); Or even this:
void action(Consumer<Result> onSuccess, Consumer<Throwable> onFail); You need to write a function that will call action:
CompletableFuture<Result> actionWrapper() { ... action(..., ...); ... } but at the same time Callbacks will be hung through the CompletableFuture, and not through the parameters of the internal action. In principle, I can write different cycling or crutch options myself, so I am interested in a more or less standard solution (perhaps through some kind of plus or minus popular lib).