In Vert.x 5, in a Future composition - how to execute an async operation regardless of the failure state
07:02 05 Feb 2026

I have a workflow that I need to asynchronously cleanup after - without losing the completion value or failure state. In essence I need an onComplete() that returns a completion.

In Java's CompletableFuture we do:

//...
.handle((v,t) -> cleanup(t) // cleanup needs to know if there was an error
    .thenCompose(t == null ? completedFuture(v) : failedFuture(t)))
.compose(f -> f)

Which - I admit - is pretty terrible, but works. But I can't find a good workaround using Vert.x 5 Future API - there's eventually(), but it is completely unaware of the status of the completion it is composed with, so it can't run our cleanup(t).

java asynchronous reactive-programming vert.x completable-future