io.vertx.core.eventbus.EventBus Java Examples

The following examples show how to use io.vertx.core.eventbus.EventBus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KinesisVerticle.java    From reactive-refarch-cloudformation with Apache License 2.0 6 votes vote down vote up
@Override
public void start() {

    EventBus eb = vertx.eventBus();

    kinesisAsyncClient = createClient();
    eventStream = System.getenv(STREAM_NAME) == null ? "EventStream" : System.getenv(STREAM_NAME);

    eb.consumer(KINESIS_EVENTBUS_ADDRESS, message -> {
        try {
            TrackingMessage trackingMessage = Json.decodeValue((String)message.body(), TrackingMessage.class);
            String partitionKey = trackingMessage.getMessageId();

            byte [] byteMessage = createMessage(trackingMessage);

            sendMessageToKinesis(byteMessage, partitionKey);

            // Now send back reply
            message.reply("OK");
        }
        catch (KinesisException exc) {
            LOGGER.error(exc);
        }
    });
}
 
Example #2
Source File: DownstreamSenderFactoryImplTest.java    From hono with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Sets up the fixture.
 */
@BeforeEach
public void setUp() {
    vertx = mock(Vertx.class);
    // run timers immediately
    when(vertx.setTimer(anyLong(), VertxMockSupport.anyHandler())).thenAnswer(invocation -> {
        final Handler<Void> task = invocation.getArgument(1);
        task.handle(null);
        return 1L;
    });
    connection = HonoClientUnitTestHelper.mockHonoConnection(vertx);
    when(connection.isConnected()).thenReturn(Future.succeededFuture());
    when(connection.isConnected(anyLong())).thenReturn(Future.succeededFuture());
    when(vertx.eventBus()).thenReturn(mock(EventBus.class));
    factory = new DownstreamSenderFactoryImpl(connection);
}
 
Example #3
Source File: MessageConsumerMethodTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testSend() throws InterruptedException {
    EventBus eventBus = Arc.container().instance(EventBus.class).get();
    BlockingQueue<Object> synchronizer = new LinkedBlockingQueue<>();
    eventBus.request("foo", "hello", ar -> {
        if (ar.succeeded()) {
            try {
                synchronizer.put(ar.result().body());
            } catch (InterruptedException e) {
                fail(e);
            }
        } else {
            fail(ar.cause());
        }
    });
    assertEquals("HELLO", synchronizer.poll(2, TimeUnit.SECONDS));
}
 
Example #4
Source File: RequestResponseEndpointTest.java    From hono with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initializes common fixture.
 */
@BeforeEach
public void setUp() {

    connection = mock(ProtonConnection.class);
    vertx = mock(Vertx.class);
    eventBus = mock(EventBus.class);
    receiver = mock(ProtonReceiver.class);
    when(receiver.handler(any())).thenReturn(receiver);
    when(receiver.closeHandler(any())).thenReturn(receiver);
    when(receiver.setAutoAccept(any(Boolean.class))).thenReturn(receiver);
    when(receiver.setPrefetch(any(Integer.class))).thenReturn(receiver);
    when(receiver.setQoS(any(ProtonQoS.class))).thenReturn(receiver);

    when(vertx.eventBus()).thenReturn(eventBus);

    final ProtonSession session = mock(ProtonSession.class);
    when(session.getConnection()).thenReturn(connection);
    sender = mock(ProtonSender.class);
    when(sender.getName()).thenReturn("mocked sender");
    when(sender.isOpen()).thenReturn(Boolean.TRUE);
    when(sender.getSession()).thenReturn(session);
}
 
Example #5
Source File: CacheBasedDeviceConnectionServiceTest.java    From hono with Eclipse Public License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private Future<Void> givenAStartedService() {

    final Vertx vertx = mock(Vertx.class);
    doAnswer(invocation -> {
        final Promise<RemoteCacheContainer> result = Promise.promise();
        final Handler<Future<RemoteCacheContainer>> blockingCode = invocation.getArgument(0);
        final Handler<AsyncResult<RemoteCacheContainer>> resultHandler = invocation.getArgument(1);
        blockingCode.handle(result.future());
        resultHandler.handle(result.future());
        return null;
    }).when(vertx).executeBlocking(any(Handler.class), any(Handler.class));
    final EventBus eventBus = mock(EventBus.class);
    when(eventBus.consumer(anyString())).thenReturn(mock(MessageConsumer.class));
    when(vertx.eventBus()).thenReturn(eventBus);
    final Context ctx = mock(Context.class);

    final Promise<Void> startPromise = Promise.promise();
    svc.init(vertx, ctx);
    try {
        svc.start(startPromise);
    } catch (Exception e) {
        return Future.failedFuture(e);
    }
    return startPromise.future();
}
 
Example #6
Source File: MessageConsumerMethodTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendAsync() throws InterruptedException {
    EventBus eventBus = Arc.container().instance(EventBus.class).get();
    BlockingQueue<Object> synchronizer = new LinkedBlockingQueue<>();
    eventBus.request("foo-async", "hello", ar -> {
        if (ar.succeeded()) {
            try {
                synchronizer.put(ar.result().body());
            } catch (InterruptedException e) {
                fail(e);
            }
        } else {
            fail(ar.cause());
        }
    });
    assertEquals("olleh", synchronizer.poll(2, TimeUnit.SECONDS));
}
 
Example #7
Source File: LocalRESTHandler.java    From vert.x-microservice with Apache License 2.0 6 votes vote down vote up
public void handleRESTPostRegistration(final EventBus eventBus, final String url, final String[] mimes) {
    routeMatcher.matchMethod(HttpMethod.POST, url, request -> {
                request.setExpectMultipart(true);
                request.endHandler(new VoidHandler() {
                    public void handle() {
                        final MultiMap attrs = request.formAttributes();
                        handleRestRequest(eventBus,
                                request,
                                url,
                                getParameterEntity(attrs),
                                Arrays.asList(mimes),
                                defaultServiceTimeout);
                    }
                });
            }
    );
}
 
Example #8
Source File: MessageConsumerMethodTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRequestContext() throws InterruptedException {
    EventBus eventBus = Arc.container().instance(EventBus.class).get();
    BlockingQueue<Object> synchronizer = new LinkedBlockingQueue<>();
    eventBus.request("request", "Martin", ar -> {
        if (ar.succeeded()) {
            try {
                synchronizer.put(ar.result().body());
            } catch (InterruptedException e) {
                fail(e);
            }
        } else {
            fail(ar.cause());
        }
    });
    assertEquals("MArtin", synchronizer.poll(2, TimeUnit.SECONDS));
}
 
Example #9
Source File: Exercise4SenderVerticle.java    From vertx-kubernetes-workshop with Apache License 2.0 6 votes vote down vote up
@Override
public void start() throws Exception {
    // Retrieve the event bus
    EventBus eventBus = vertx.eventBus();

    // Execute the given handler every 2000 ms
    vertx.setPeriodic(2000, l -> {
        // Use the eventBus() method to retrieve the event bus and send a "{"message":hello"} JSON message on the
        // "greetings" address.

        // 1 - Create the JSON object using the JsonObject class, and `put` the 'message':'hello' entry
        // TODO

        // 2 - Use the `send` method of the event bus to _send_ the message. Messages sent with the `send` method
        // are received by a single consumer. Messages sent with the `publish` method are received by all
        // registered consumers.
        // TODO
        
    });
}
 
Example #10
Source File: ApiCodegenExamples.java    From vertx-web with Apache License 2.0 6 votes vote down vote up
public void serviceMountExample(EventBus eventBus, Router router, SchemaParser schemaParser) {
  router.get("/api/transactions")
    .handler(
      ValidationHandlerBuilder.create(schemaParser)
        .queryParameter(optionalParam("from", stringSchema()))
        .queryParameter(optionalParam("to", stringSchema()))
        .build()
    ).handler(
      RouteToEBServiceHandler.build(eventBus, "transactions.myapplication", "getTransactionsList")
    );
  router.post("/api/transactions")
    .handler(
      ValidationHandlerBuilder.create(schemaParser)
        .body(json(objectSchema()))
        .build()
    ).handler(
      RouteToEBServiceHandler.build(eventBus, "transactions.myapplication", "putTransaction")
    );
}
 
Example #11
Source File: SockJSVisitor.java    From nubes with Apache License 2.0 6 votes vote down vote up
private Object[] getParamValues(Method method, SockJSSocket socket, Buffer msg) {
  final Vertx vertx = config.getVertx();
  List<Object> paramInstances = new ArrayList<>();
  for (Class<?> parameterClass : method.getParameterTypes()) {
    if (parameterClass.equals(SockJSSocket.class)) {
      paramInstances.add(socket);
    } else if (Buffer.class.isAssignableFrom(parameterClass)) {
      paramInstances.add(msg);
    } else if (parameterClass.equals(EventBus.class)) {
      paramInstances.add(vertx.eventBus());
    } else if (parameterClass.equals(Vertx.class)) {
      paramInstances.add(vertx);
    }
  }
  return paramInstances.toArray();
}
 
Example #12
Source File: EventBusBridgeVisitor.java    From nubes with Apache License 2.0 6 votes vote down vote up
private void tryToInvoke(Object instance, Method method, BridgeEvent be) {
  List<Object> paramInstances = new ArrayList<>();
  for (Class<?> parameterClass : method.getParameterTypes()) {
    final Vertx vertx = config.getVertx();
    if (parameterClass.equals(BridgeEvent.class)) {
      paramInstances.add(be);
    } else if (parameterClass.equals(EventBus.class)) {
      paramInstances.add(vertx.eventBus());
    } else if (parameterClass.equals(Vertx.class)) {
      paramInstances.add(vertx);
    }
  }
  try {
    method.invoke(instance, paramInstances.toArray());
  } catch (Exception e) {
    LOG.error("Error while handling websocket", e);
    if (!be.failed() && !be.succeeded()) {
      be.fail(e);
    }
  }
}
 
Example #13
Source File: RedisVerticle.java    From reactive-refarch-cloudformation with Apache License 2.0 6 votes vote down vote up
void registerToEventBusForPubSub(final EventBus eb, final RedisClient redis) {

        // register a handler for the incoming message the naming the Redis module will use is base address + '.' + redis channel
        vertx.eventBus().<JsonObject>consumer(REDIS_PUBSUB_CHANNEL_VERTX, received -> {
            // do whatever you need to do with your message
            JsonObject value = received.body().getJsonObject("value");
            LOGGER.info("Received the following message: " + value);
            // the value is a JSON doc with the following properties
            // channel - The channel to which this message was sent
            // pattern - Pattern is present if you use psubscribe command and is the pattern that matched this message channel
            // message - The message payload

            String message = value.getString("message");

            JsonObject jsonObject = new JsonObject(message);
            eb.send(CACHE_REDIS_EVENTBUS_ADDRESS, jsonObject);
        });

        redis.subscribe(Constants.REDIS_PUBSUB_CHANNEL, res -> {
            if (res.succeeded()) {
                LOGGER.info("Subscribed to " + Constants.REDIS_PUBSUB_CHANNEL);
            } else {
                LOGGER.info(res.cause());
            }
        });
    }
 
Example #14
Source File: FileBasedRegistrationServiceTest.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Sets up the fixture.
 */
@BeforeEach
public void setUp() {
    fileSystem = mock(FileSystem.class);
    eventBus = mock(EventBus.class);
    vertx = mock(Vertx.class);
    when(vertx.eventBus()).thenReturn(eventBus);
    when(vertx.fileSystem()).thenReturn(fileSystem);

    registrationConfig = new FileBasedRegistrationConfigProperties();
    registrationConfig.setFilename(FILE_NAME);

    registrationService = new FileBasedRegistrationService(vertx);
    registrationService.setConfig(registrationConfig);
}
 
Example #15
Source File: RESTHandler.java    From vert.x-microservice with Apache License 2.0 5 votes vote down vote up
public void handleRESTGetRegistration(final EventBus eventBus, final String url, final String[] mimes) {
    routeMatcher.matchMethod(HttpMethod.GET, url, request ->
                    handleRestRequest(eventBus,
                            request,
                            url,
                            getParameterEntity(request.params()),
                            Arrays.asList(mimes),
                            defaultServiceTimeout)
    );
}
 
Example #16
Source File: FileBasedTenantServiceTest.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Sets up fixture.
 */
@BeforeEach
public void setUp() {
    fileSystem = mock(FileSystem.class);
    eventBus = mock(EventBus.class);
    vertx = mock(Vertx.class);
    when(vertx.eventBus()).thenReturn(eventBus);
    when(vertx.fileSystem()).thenReturn(fileSystem);

    props = new FileBasedTenantsConfigProperties();
    svc = new FileBasedTenantService(vertx);
    svc.setConfig(props);
}
 
Example #17
Source File: MapBasedDeviceConnectionServiceTest.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Sets up fixture.
 */
@BeforeEach
public void setUp() {
    span = mock(Span.class);

    final EventBus eventBus = mock(EventBus.class);
    final Vertx vertx = mock(Vertx.class);
    when(vertx.eventBus()).thenReturn(eventBus);

    svc = new MapBasedDeviceConnectionService();
    props = new MapBasedDeviceConnectionsConfigProperties();
    svc.setConfig(props);
}
 
Example #18
Source File: CompulsiveTraderVerticle.java    From microtrader with MIT License 5 votes vote down vote up
@Override
public void start(Future<Void> future) {
    super.start();

    // Get configuration
    config = ConfigFactory.load();

    String company = TraderUtils.pickACompany();
    int numberOfShares = TraderUtils.pickANumber();

    EventBus eventBus = vertx.eventBus();
    EventBusService.getProxy(discovery, PortfolioService.class, ar -> {
        if (ar.failed()) {
            System.out.println("Portfolio service could not be retrieved: " + ar.cause());
        } else {
            // Our services:
            PortfolioService portfolio = ar.result();
            MessageConsumer<JsonObject> marketConsumer = eventBus.consumer(config.getString("market.address"));

            // Listen to the market...
            marketConsumer.handler(message -> {
                JsonObject quote = message.body();
                TraderUtils.dumbTradingLogic(company, numberOfShares, portfolio, quote);
            });
        }
    });
}
 
Example #19
Source File: TenantManager.java    From okapi with Apache License 2.0 5 votes vote down vote up
private void consumeTimers() {
  EventBus eb = vertx.eventBus();
  eb.consumer(EVENT_NAME, res -> {
    String tenantId = (String) res.body();
    handleTimer(tenantId);
  });
}
 
Example #20
Source File: WSMessageReply.java    From vert.x-microservice with Apache License 2.0 5 votes vote down vote up
public WSMessageReply(WSEndpoint endpoint, EventBus bus, String localReply, String replyToAll, String replyToAllButSender,String selfHostedPostfix, boolean selfhosted) {
    this.endpoint = endpoint;
    this.bus = bus;
    this.selfHostedPostfix = selfHostedPostfix;
    this.selfhosted = selfhosted;
    this.localReply = selfhosted?localReply+selfHostedPostfix:localReply;
    this.replyToAll = selfhosted?replyToAll+selfHostedPostfix:replyToAll;
    this.replyToAllButSender = selfhosted?replyToAllButSender+selfHostedPostfix:replyToAllButSender;
}
 
Example #21
Source File: WSClusterHandler.java    From vert.x-microservice with Apache License 2.0 5 votes vote down vote up
private void addDefinitionToRegistry(ServerWebSocket serverSocket, EventBus eventBus, String path, WSEndpoint endpoint, AsyncMap<String, WSEndpointHolder> registryMap, WSEndpointHolder wsEndpointHolder) {
    wsEndpointHolder.add(endpoint);
    registryMap.replace(WS_ENDPOINT_HOLDER, wsEndpointHolder, s -> {
                if (s.succeeded()) {
                    log("OK REPLACE: " + serverSocket.binaryHandlerID() + "  Thread" + Thread.currentThread());
                    sendToWSService(serverSocket, eventBus, path, endpoint);
                }
            }
    );
}
 
Example #22
Source File: AuditVerticle.java    From microtrader with MIT License 5 votes vote down vote up
/**
 * Starts the verticle asynchronously. The the initialization is completed, it calls
 * `complete()` on the given {@link Future} object. If something wrong happens,
 * `fail` is called.
 *
 * @param future the future to indicate the completion
 */
@Override
public void start(Future<Void> future) throws ClassNotFoundException {
    super.start();

    // Get configuration
    config = ConfigFactory.load();

    // creates the jdbc client.
    JsonObject jdbcConfig = new JsonObject(config.getObject("jdbc").render(ConfigRenderOptions.concise()));
    jdbc = JDBCClient.createNonShared(vertx, jdbcConfig);
    Class.forName(jdbcConfig.getString("driverclass"));

    // Start HTTP server and listen for portfolio events
    EventBus eventBus = vertx.eventBus();
    Future<HttpServer> httpEndpointReady = configureTheHTTPServer();
    httpEndpointReady.setHandler(ar -> {
       if (ar.succeeded()) {
           MessageConsumer<JsonObject> portfolioConsumer = eventBus.consumer(config.getString("portfolio.address"));
           portfolioConsumer.handler(message -> {
               storeInDatabase(message.body());
           });
           future.complete();
       } else {
           future.fail(ar.cause());
       }
    });

    publishHttpEndpoint("audit", config.getString("http.host"), config.getInt("http.public.port"), config.getString("http.root"), ar -> {
        if (ar.failed()) {
            ar.cause().printStackTrace();
        } else {
            System.out.println("Audit (Rest endpoint) service published : " + ar.succeeded());
        }
    });
}
 
Example #23
Source File: Exercise5ProcessorVerticle.java    From vertx-kubernetes-workshop with Apache License 2.0 5 votes vote down vote up
@Override
public void start() throws Exception {
    EventBus eventBus = vertx.eventBus();

    // Register a consumer and call the `reply` method with a JSON object containing the greeting message. ~
    // parameter is passed in the incoming message body (a name). For example, if the incoming message is the
    // String "vert.x", the reply contains: `{"message" : "hello vert.x"}`.
    // Unlike the previous exercise, the incoming message has a `String` body.
    // TODO
   
}
 
Example #24
Source File: Receiver.java    From tools-journey with Apache License 2.0 5 votes vote down vote up
@Override
public void start() {
    EventBus eb = vertx.eventBus();
    eb.consumer("ping-address", message -> {
        System.out.println("Received message: " + message.body());
        // Now send back reply
        message.reply("pong!");
    });

    System.out.println("Receiver ready!");
}
 
Example #25
Source File: Sender.java    From tools-journey with Apache License 2.0 5 votes vote down vote up
@Override
public void start() {
    EventBus eb = vertx.eventBus();
    // Send a message every second
    vertx.setPeriodic(1000, v -> {
        eb.send("ping-address", "ping!", reply -> {
            if (reply.succeeded()) {
                System.out.println("Received reply " + reply.result().body());
            } else {
                System.out.println("No reply");
            }
        });

    });
}
 
Example #26
Source File: ClusterReceiver.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void start() {
    EventBus eventBus = vertx.eventBus();
    eventBus.registerDefaultCodec(CustomMessage.class, new CustomMessageCodec());

    eventBus.consumer("cluster-message-receiver",
            message -> message.reply(new CustomMessage("cluster-message-receiver reply")));
}
 
Example #27
Source File: CacheVerticle.java    From reactive-refarch-cloudformation with Apache License 2.0 5 votes vote down vote up
private void registerToEventBusToGetData(final EventBus eb) {
    eb.consumer(Constants.CACHE_EVENTBUS_ADDRESS, message -> {
        // Is data stored in cache?

        TrackingMessage trackingMessage = Json.decodeValue(((JsonObject)message.body()).encode(), TrackingMessage.class);
        LOGGER.debug("Wrote message to cache: " + message.body());
        TrackingMessage value = CACHE.getIfPresent(trackingMessage.getProgramId());

        if (null == value) {
            JsonObject msgToSend = JsonObject.mapFrom(trackingMessage);
            LOGGER.info("Key " + trackingMessage.getProgramId() + " not found in cache --> Redis");
            eb.send(Constants.REDIS_EVENTBUS_ADDRESS, msgToSend, res -> {
                if (res.succeeded()) {
                    JsonObject msg = (JsonObject)res.result().body();

                    if (msg.isEmpty()) {
                        message.reply(msg);
                    } else {
                        LOGGER.debug("Message from Redis-Verticle: " + msg);
                        TrackingMessage msgFromRedis = Json.decodeValue(msg.encode(), TrackingMessage.class);
                        CACHE.put(msgFromRedis.getProgramId(), msgFromRedis);

                        message.reply(msg);
                    }
                } else {
                    message.reply(new JsonObject());
                }
            });
        } else {
            LOGGER.debug("Message " + Json.encode(value) + " found in cache --> HttpVerticle");
            value.setMessageId(trackingMessage.getMessageId());
            message.reply(JsonObject.mapFrom(value));
        }
    });
}
 
Example #28
Source File: CacheVerticle.java    From reactive-refarch-cloudformation with Apache License 2.0 5 votes vote down vote up
private void registerToEventBusForUpdates(final EventBus eb) {
    // Writing the data into the cache
    // Called from Redis verticle (Redis pub/sub-update)
    eb.consumer(Constants.CACHE_REDIS_EVENTBUS_ADDRESS, message -> {
        LOGGER.debug("I have received a message: " + message.body());
        LOGGER.debug("Message type: " + message.body().getClass().getName());
        writeDataToCache(message);
    });
}
 
Example #29
Source File: ApiCodegenExamples.java    From vertx-web with Apache License 2.0 5 votes vote down vote up
public void mountHandler(EventBus eventBus, Router router, ValidationHandler validationHandler) {
  router
    .get("/hello")
    .handler(validationHandler)
    .handler(
      RouteToEBServiceHandler
        .build(eventBus, "greeters.myapplication", "hello")
    );
}
 
Example #30
Source File: MetricsTest.java    From vertx-dropwizard-metrics with Apache License 2.0 5 votes vote down vote up
@Test
public void testMetricsCleanupedOnVertxClose() throws Exception {
  CountDownLatch latch1 = new CountDownLatch(1);
  HttpServer server = vertx.createHttpServer(new HttpServerOptions().setPort(8080));
  server.requestHandler(req -> {});
  server.listen(onSuccess(res -> {
    latch1.countDown();
  }));
  awaitLatch(latch1);
  HttpClient client = vertx.createHttpClient(new HttpClientOptions());
  CountDownLatch latch2 = new CountDownLatch(1);
  NetServer nServer = vertx.createNetServer(new NetServerOptions().setPort(1234));
  nServer.connectHandler(conn -> {});
  nServer.listen(res -> {
    latch2.countDown();
  });
  awaitLatch(latch2);
  NetClient nClient = vertx.createNetClient(new NetClientOptions());
  DatagramSocket sock = vertx.createDatagramSocket(new DatagramSocketOptions());
  EventBus eb = vertx.eventBus();
  assertFalse(metricsService.getMetricsSnapshot(vertx).isEmpty());
  assertFalse(metricsService.getMetricsSnapshot(server).isEmpty());
  assertFalse(metricsService.getMetricsSnapshot(client).isEmpty());
  assertFalse(metricsService.getMetricsSnapshot(nServer).isEmpty());
  assertFalse(metricsService.getMetricsSnapshot(nClient).isEmpty());
  assertFalse(metricsService.getMetricsSnapshot(sock).isEmpty());
  assertFalse(metricsService.getMetricsSnapshot(eb).isEmpty());
  vertx.close(res -> {
    assertTrue(metricsService.getMetricsSnapshot(vertx).isEmpty());
    assertTrue(metricsService.getMetricsSnapshot(server).isEmpty());
    assertTrue(metricsService.getMetricsSnapshot(client).isEmpty());
    assertTrue(metricsService.getMetricsSnapshot(nServer).isEmpty());
    assertTrue(metricsService.getMetricsSnapshot(nClient).isEmpty());
    assertTrue(metricsService.getMetricsSnapshot(sock).isEmpty());
    assertTrue(metricsService.getMetricsSnapshot(eb).isEmpty());
    testComplete();
  });
  await();
  vertx = null;
}