Vert.x utils
Common Vert.x utilities, written in Kotlin.
Installation
Maven
Add Maven dependency:
<dependency>
<groupId>com.github.rfksystems</groupId>
<artifactId>vertx_utils</artifactId>
<version>${vertx_utils.version}</version>
</dependency>
Utility classes
ManagedVerticleFactory
io.vertx.core.spi.VerticleFactory implementation that sources all options, including class name, deployment options and configuration from io.vertx.core.json.JsonObject structure.
Designed to work with Vert.x Config component, it will also work with anything else provided that the data structure for JsonObject remains the same.
Usage
Define configuration (example in Yaml, but all providers should work given same structure):
com.example.someapp.services.web:
main: com.example.someapp.services.WebServiceVerticle # Verticle class
options: # Verticle Deployment options
ha: true
instances: 5
worker: true
config: # Verticle config, available via config() in verticle class
foo: bar
port: 8091
Load configuration and construct the ManagedVerticleFactory providing instance of io.vertx.core.json.JsonObject with above configuration.
Register it to Vert.x
final ManagedVerticleFactory = new ManagedVerticleFactory(servicesConfiguration);
vertx.registerVerticleFactory(managedVerticleFactory);
Deploy verticle:
vertx.deploy("local:com.example.someapp.services.web")
You can change the default local prefix to whatever you please using secondary constructor of ManagedVerticleFactory.
Other managers
License
Apache License, Version 2.0