use of io.vertx.mutiny.ext.web.client.HttpResponse in project reactive-systems-in-java by cescoffier.
the class UniApi method main.
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
WebClient client = WebClient.create(vertx);
Uni<HttpResponse<Buffer>> uni = client.getAbs("https://httpbin.org/json").send();
uni.onItem().transform(HttpResponse::bodyAsJsonObject).onFailure().recoverWithItem(new JsonObject().put("message", "fallback")).subscribe().with(json -> System.out.println("Got json document: " + json));
}
Aggregations