quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.82k stars 2.69k forks source link

Pure Quarkus vertx app is missing "io.vertx.ext.web.Router" #31577

Closed pjgg closed 1 year ago

pjgg commented 1 year ago

Describe the bug

Following this post https://quarkus.io/blog/magic-control/ , I am trying to develop a Quarkus app without magic through Vertx, basically, my dependencies are just

implementation 'io.quarkus:quarkus-vertx'

And my application code is:

import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.QuarkusApplication;
import io.quarkus.runtime.annotations.QuarkusMain;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import org.eclipse.microprofile.config.ConfigProvider;

@QuarkusMain
public class Main implements QuarkusApplication {

    public static void main(String... args) {
        Quarkus.run(Main.class, args);
    }

    @Override
    public int run(String... args) {
        Vertx vertx = Vertx.vertx();
        Router router = Router.router(vertx);

        String message = ConfigProvider.getConfig().getValue("message", String.class);

        router.get("/").handler(rc -> rc.response().end(message));
        router.get("/bye").handler(rc -> {
            rc.response().end("bye");
            Quarkus.asyncExit();
        });

        HttpServer server = vertx.createHttpServer()
                .requestHandler(router)
                .listen(8080);

        Quarkus.waitForExit();

        server.close();
        return 0;
    }
}

But the import import io.vertx.ext.web.Router is not found. In my opinion, the extension io.quarkus:quarkus-vertx should include all Vertx required dependencies in order to run a basic pure vertx microservice.

Workaround: Add as a dependency the extension io.quarkus:quarkus-smallrye-openapi

geoand commented 1 year ago

You need to add io.quarkus:quarkus-vertx-http which brings in io.vertx:vertx-web

pjgg commented 1 year ago

You need to add io.quarkus:quarkus-vertx-http which brings in io.vertx:vertx-web

Sorry was my fault is full described here: https://quarkus.io/blog/magic-control/#using-the-managed-http-server

geoand commented 1 year ago

NP :)