I tried to experience the SmallRye Mutiny Vertx bindings, the complete example codes can be found on my Github.
When assembling the routings like this.
router.get("/posts/:id").produces("application/json")
.handler(handlers::get);
//.failureHandler(frc -> frc.response().setStatusCode(404).end());
The failureHandler
will block the request.
The problem here is that end returns a Uni
object. You can think of it as a function. This function is lazy. What you want to do instead is call that function. This can be achieved by subscribing to it.
If you're not interested in processing the result of this Uni
, you can use endAndForget
instead of end
which will call that function for you (subscribe to the Uni
).
If you would like to do something with the result of the Uni
, you can subscribe instead:
.failureHandler(frc ->
frc.response()
.setStatusCode(404)
.end()
.subscribe().with(ignore -> System.out.println("failure handler is done"))
);