title: Vertx instance variable is null when trying to access it from it's method
body: <p>Below is verticle </p>
  
  <pre><code>package com.api.redis.gateway.verticle;
  
  import java.util.UUID;
  
  import io.vertx.core.json.JsonObject;
  import io.vertx.ext.web.RoutingContext;
  import io.vertx.redis.RedisClient;
  import io.vertx.redis.RedisOptions;
  
  public class SimpleRestChild extends SimpleRestServer{
  
       RedisClient client;
  
  
  @Override
  public void start() {
      // TODO Auto-generated method stub
      super.start();
  
      client = RedisClient.create(vertx, new RedisOptions().setHost("127.0.0.1").setPort(6379));
      client.subscribe("channelForServiceToPublish", handler -&gt; {
          if(handler.succeeded())
              System.out.println("SimpleRestServer subscibed to the channel successfully");
      });
  
  }
  
  public void handleSubscription(RoutingContext routingContext) {
      JsonObject requestAsJson = routingContext.getBodyAsJson();
  
      requestAsJson.put("uuid", getUUID());
  
      // this client object is null.
      client.set("request", requestAsJson.toString(), handler -&gt;{
          System.out.println("Simple server is setting value to redis client");
          if(handler.succeeded()) {
              System.out.println("Key and value is stored in Redis Server");
          }else if(handler.failed()) {
              System.out.println("Key and value is failed to be stored on Redis Server with cause : "+ handler.cause().getMessage());
          }
      });
  
  
      client.publish("channelForServerToPublish", "ServiceOne", handler -&gt; {
          if(handler.succeeded()) {
              System.out.println("Simple Server published message successfully");
          }else if(handler.failed()) {
              System.out.println("Simple Server failed to published message");
          }
      });
  
      routingContext.vertx().eventBus().consumer("io.vertx.redis.channelForServiceToPublish", handler -&gt; {
          client.get("response", res -&gt;{
              if(res.succeeded()) {
                  JsonObject responseAsJson = new JsonObject(res.result());
                  if(responseAsJson.getString("uuid").equalsIgnoreCase(requestAsJson.getString("uuid"))) {
                      routingContext.response().setStatusCode(200).end(res.result());
                  }
              }else if(res.failed()) {
                  System.out.println("Failed to get message from Redis Server");
                  routingContext.response().setStatusCode(500).end("Server Error ");
              }
          });
  
  
      });
  }
  
  private String getUUID() {
      UUID uid = UUID.randomUUID();
      return uid.toString();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And below is the main verticle from where the above verticle is getting deployed and on any request to httpserver it's hanlder method is getting called.</p>
  
  <pre><code>package com.api.redis.gateway.verticle;
  
  import io.vertx.core.AbstractVerticle;
  import io.vertx.ext.web.Router;
  import io.vertx.ext.web.handler.BodyHandler;
  import io.vertx.redis.RedisClient;
  import io.vertx.redis.RedisOptions;
  
  
  public class SimpleRestServer extends AbstractVerticle{
  
  
  
  @Override
  public void start(){
      int http_port = 9001;
  
      vertx.deployVerticle("com.api.redis.gateway.verticle.SimpleRestChild", handler -&gt; {
          if(handler.succeeded()) {
              System.out.println(" SimpleRestChild deployed successfully");
          }
      });
  
      Router router = Router.router(vertx);
      router.route().handler(BodyHandler.create());
  
      SimpleRestChild child = null;
  
      try {
          child = (SimpleRestChild) Class.forName("com.api.redis.gateway.verticle.SimpleRestChild").newInstance();
      } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
          e.printStackTrace();
      }
  
      router.route("/subscription").handler(child::handleSubscription);
      vertx.createHttpServer().requestHandler(router::accept).listen(http_port);
      System.out.println("Server started at port : " + http_port);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>When handleSubscription is getting called for any "/subscription" request. client object is coming as null.</p>
  
  <p>As per my understanding two objects are getting created here. One with start() and other not having start(). </p>
  
  <p>I want to initialize Redisclient once.And use this object when handleSubscription() will get called for any request to "/subscription".</p>
  
  <p>How to achieve this ?</p>
  
  <p>How to fix this problem.</p>