Created
January 21, 2021 01:04
-
-
Save limadelrey/9f1ba6b519e29264ca0b5ff2a833682f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainVerticle extends AbstractVerticle { | |
private static final Logger LOGGER = LoggerFactory.getLogger(MainVerticle.class); | |
@Override | |
public void start() { | |
final long start = System.currentTimeMillis(); | |
deployMigrationVerticle(vertx) | |
.flatMap(migrationVerticleId -> deployApiVerticle(vertx)) | |
.onSuccess(success -> LOGGER.info(LogUtils.RUN_APP_SUCCESSFULLY_MESSAGE.buildMessage(System.currentTimeMillis() - start))) | |
.onFailure(throwable -> LOGGER.error(throwable.getMessage())); | |
} | |
private Future<Void> deployMigrationVerticle(Vertx vertx) { | |
final DeploymentOptions options = new DeploymentOptions() | |
.setWorker(true) | |
.setWorkerPoolName("migrations-worker-pool") | |
.setInstances(1) | |
.setWorkerPoolSize(1); | |
return vertx.deployVerticle(MigrationVerticle.class.getName(), options) | |
.flatMap(vertx::undeploy); | |
} | |
private Future<String> deployApiVerticle(Vertx vertx) { | |
return vertx.deployVerticle(ApiVerticle.class.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment