package verticle;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.eventbus.MessageConsumer;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.client.WebClient;
import io.vertx.ext.web.codec.BodyCodec;

public class ConsumerVerticle extends AbstractVerticle {

    private String verticleAddress = "Weather";
    private EventBus eventBus;

    @Override
    public void start() throws Exception {
        assignEventBus();
        registerHandler();
    }

    private void assignEventBus() {
        eventBus = vertx.eventBus();
    }

    private void registerHandler() {
        MessageConsumer<JsonObject> messageConsumer = eventBus.consumer(verticleAddress);
        messageConsumer.handler(message -> {
            JsonObject jsonMessage = message.body();
            System.out.println(jsonMessage.getValue("message_from_HTTP_request"));
            WebClient webClient = WebClient.create(vertx);
            webClient.get(443, "jsonplaceholder.typicode.com", "/posts/1").ssl(true).as(BodyCodec.jsonObject())
                    .send(httpResponseAsyncResult -> {
                        if(httpResponseAsyncResult.succeeded()) {
                            JsonObject jsonReply = httpResponseAsyncResult.result().body();
                            jsonReply.put("reply", "how interesting!");
                            message.reply(jsonReply);
                        }
                    });
        });
    }
}

@@ -179,91 +179,8 @@
 ect;
-%0Aimport io.vertx.ext.web.client.WebClient;%0Aimport io.vertx.ext.web.codec.BodyCodec;
 %0A%0Apu
@@ -277,13 +277,14 @@
  = %22
-Weath
+Consum
 er%22;
@@ -808,446 +808,79 @@
 rom_
-HTTP_request%22));%0A            WebClient webClient = WebClient.create(vertx);%0A            webClient.get(443, %22jsonplaceholder.typicode.com%22, %22/posts/1%22).ssl(true).as(BodyCodec.jsonObject())%0A                    .send(httpResponseAsyncResult -%3E %7B%0A                        if(httpResponseAsyncResult.succeeded()) %7B%0A                            JsonObject jsonReply = httpResponseAsyncResult.result().body();%0A                            jsonReply
+sender_verticle%22));%0A            JsonObject jsonReply = new JsonObject()
 .put
@@ -922,32 +922,16 @@
         
-          
-      
 message.
@@ -952,58 +952,8 @@
 y);%0A
-                        %7D%0A                    %7D);%0A
     

Update ConsumerVerticle.java