1
votes

I want to test Quarkus and the native image for Docker with an existing project written in Kotlin and using Vert.x verticles.

Can you point me to an example on how to deploy verticles using Quarkus?

My dependencies are vertx-sockjs-service-proxy and vertx-lang-kotlin.

I found some examples in the Vert.x extension tests but I cannot find how to deploy my verticles at server startup.

@Inject
EventBus eventBus;

@Route(path = "/hello-event-bus", methods = GET)
void helloEventBus (RoutingExchange exchange){
    eventBus.send("hello", exchange.getParam("name").orElse("missing"), ar -> {
        if (ar.succeeded()) {
            exchange.ok(ar.result().body().toString());
        } else {
            exchange.serverError().end(ar.cause().getMessage());
        }
    });
}
1

1 Answers

8
votes

You can use verticle as follows:

@Inject Vertx vertx;

void onStart(@Observes StartupEvent ev) {               
    vertx.deploy(new MyVerticleA());
    vertx.deploy(new MyVerticleB());
}