@@ -0,0 +1,2324 @@
+package no.javazone;%0A%0A%0Aimport io.vertx.core.*;%0Aimport io.vertx.core.buffer.Buffer;%0Aimport io.vertx.core.http.HttpClient;%0Aimport io.vertx.core.json.Json;%0A%0Apublic class VertxCallbackHellExample %7B%0A%0A    static Vertx vertx = Vertx.vertx();%0A    static HttpClient httpClient = vertx.createHttpClient();%0A%0A    public static void main(String%5B%5D args) throws Exception %7B%0A        TaskRunner taskRunner = new TaskRunner(100_000);%0A        taskRunner.runTask(() -%3E getPersonInCity(%22abc%22, result -%3E %7B%0A            if (result.succeeded()) %7B%0A                //System.out.println(result.result());%0A            %7D else %7B%0A                result.cause().printStackTrace();%0A            %7D%0A            taskRunner.countDown();%0A        %7D));%0A        vertx.close();%0A    %7D%0A%0A    public static void getPersonInCity(String id, Handler%3CAsyncResult%3CTypicalExamples.PersonInCity%3E%3E handler) %7B%0A        if (!validateId(id)) %7B%0A            handler.handle(Future.failedFuture(new IllegalArgumentException(%22ugyldig id%22)));%0A        %7D%0A%0A        httpClient.getNow(8080, %22localhost%22, %22/person/%22 + id, personResponse -%3E %7B%0A            personResponse.bodyHandler(%0A                    personBody -%3E %7B%0A                        TypicalExamples.Person person = parsePerson(personBody);%0A                        httpClient.getNow(8080, %22localhost%22, %22/address/%22 + id, addressResponse -%3E addressResponse.bodyHandler(%0A                                addressBody -%3E %7B%0A                                    TypicalExamples.Address address = parseAddress(addressBody);%0A                                    handler.handle(Future.succeededFuture(translate(person, address)));%0A                                %7D));%0A                    %7D);%0A        %7D);%0A    %7D%0A%0A    private static TypicalExamples.Address parseAddress(Buffer body) %7B%0A        return Json.decodeValue(body.getString(0, body.length()), TypicalExamples.Address.class);%0A    %7D%0A%0A    private static TypicalExamples.Person parsePerson(Buffer body) %7B%0A        return Json.decodeValue(body.getString(0, body.length()), TypicalExamples.Person.class);%0A    %7D%0A%0A    private static TypicalExamples.PersonInCity translate(TypicalExamples.Person p, TypicalExamples.Address a)%7B%0A        return new TypicalExamples.PersonInCity(p.name, a.city);%0A    %7D%0A%0A    private static boolean validateId(String id) %7B%0A        return !(id == null %7C%7C id.isEmpty());%0A    %7D%0A%0A%0A%7D%0A

add callback hell example