Vert.x 5 io.vertx.core.Launcher removed - Stack Overflow

admin2025-04-18  3

I have an application written in v4.5.11 that uses, io.vertx.core.Launcher and I'm able to get the json config parsed in the hook afterConfigParsed. With version 5, the Launcher has been replaced by Vert.x.application.Launcher and the hook used before, doesn't exist anymore. Now with the new class, in which hook can I access the parsed json and when does the parser happens?

I have an application written in v4.5.11 that uses, io.vertx.core.Launcher and I'm able to get the json config parsed in the hook afterConfigParsed. With version 5, the Launcher has been replaced by Vert.x.application.Launcher and the hook used before, doesn't exist anymore. Now with the new class, in which hook can I access the parsed json and when does the parser happens?

Share asked Jan 30 at 12:59 Eduardo SantosEduardo Santos 71 silver badge8 bronze badges 4
  • Indeed, it doesn't exist anymore. Can you elaborate about the use case? – tsegismont Commented Jan 30 at 17:33
  • I have a microframework built on Vert.x 4.5.10 that handles various tasks, primarily configuration-related, relying on this hook—such as ClusteredLauncherTask and OpenTelemetry. According to the documentation, OpenTelemetry should be configured in beforeStartingVertx if I want to use ConfigRetriever. However, at that point, the Vert.x instance is not yet available, but I need it. This is one of the example. My framework is designed to provide common service configurations for all my microservices. What would be the best way to preserve its current behavior? – Eduardo Santos Commented Feb 5 at 8:53
  • Do you need access to the raw JSON config? Otherwise you could use io.vertx.launcher.application.VertxApplicationHooks#beforeStartingVertx or io.vertx.launcher.application.VertxApplicationHooks#createVertxBuilder – tsegismont Commented Feb 5 at 16:08
  • Yes, I need access to it. Is there any other way to get it? – Eduardo Santos Commented Feb 10 at 16:15
Add a comment  | 

1 Answer 1

Reset to default 0

In Vert.x 4, the VertxLifecycleHooks#afterConfigParsed method was invoked before starting Vert.x with the verticle config as parameter.

In Vert.x 5, with the application launcher you can override VertxApplicationHooks#beforeStartingVertx and get the JSON verticle config with hookContext.deploymentOptions().getConfig().

转载请注明原文地址:http://anycun.com/QandA/1744917532a89456.html