Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verticle api improvements #5087

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Verticle api improvements #5087

wants to merge 1 commit into from

Conversation

vietj
Copy link
Member

@vietj vietj commented Feb 1, 2024

A new base class implementing io.vertx.core.Verticle called VerticleBase that simplifies the creation of a verticle and uses method returning futures. Methods that should not be overridden by users are final.

// Current way
vertx.deployVerticle(new AbstractVerticle() {
  private HttpServer server;
  public void start(Promise<Void> promise) {
    server = vertx.createHttpServer().requestHandler(requestHandler);
    server
      .listen()
      .<Void>mapEmpty().onComplete(promise);
  }
});

// New way
vertx.deployVerticle(new VerticleBase() {
  private HttpServer server;
  public Future<Void> start() {
    server = vertx.createHttpServer().requestHandler(requestHandler);
    return server.listen();
  }
});

Open questions:

  • how do we handle sync start (virtual thread actually use it) ?

@vietj vietj added this to the 5.0.0 milestone Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant