use of org.eclipse.hono.util.WrappedLifecycleComponentVerticle in project hono by eclipse.
the class AbstractProtocolAdapterApplication method doStart.
@Override
protected void doStart() {
LOG.info("deploying {} {} instances ...", appConfig.getMaxInstances(), getComponentName());
final CompletableFuture<Void> startup = new CompletableFuture<>();
final Future<String> adapterTracker = vertx.deployVerticle(this::adapter, new DeploymentOptions().setInstances(appConfig.getMaxInstances()));
final Future<String> notificationReceiverTracker = vertx.deployVerticle(new WrappedLifecycleComponentVerticle(notificationReceiver()));
CompositeFuture.all(adapterTracker, notificationReceiverTracker).compose(s -> healthCheckServer.start()).onSuccess(ok -> startup.complete(null)).onFailure(startup::completeExceptionally);
startup.join();
}
use of org.eclipse.hono.util.WrappedLifecycleComponentVerticle in project hono by eclipse.
the class Application method doStart.
@Override
protected void doStart() {
if (!(authenticationService instanceof Verticle)) {
throw new IllegalStateException("Authentication service must be a vert.x Verticle");
}
LOG.info("adding common tags to meter registry");
meterRegistry.config().commonTags(MetricsTags.forService(Constants.SERVICE_NAME_DEVICE_REGISTRY));
LOG.info("deploying {} {} instances ...", appConfig.getMaxInstances(), getComponentName());
final CompletableFuture<Void> startup = new CompletableFuture<>();
// deploy authentication service (once only)
final Promise<String> authServiceDeploymentTracker = Promise.promise();
vertx.deployVerticle((Verticle) authenticationService, authServiceDeploymentTracker);
// deploy notification sender (once only)
final Promise<String> notificationSenderDeploymentTracker = Promise.promise();
vertx.deployVerticle(new WrappedLifecycleComponentVerticle(notificationSender), notificationSenderDeploymentTracker);
// deploy AMQP 1.0 server
final Promise<String> amqpServerDeploymentTracker = Promise.promise();
vertx.deployVerticle(() -> amqpServerFactory.newServer(), new DeploymentOptions().setInstances(appConfig.getMaxInstances()), amqpServerDeploymentTracker);
// deploy HTTP server
final Promise<String> httpServerDeploymentTracker = Promise.promise();
vertx.deployVerticle(() -> httpServerFactory.newServer(), new DeploymentOptions().setInstances(appConfig.getMaxInstances()), httpServerDeploymentTracker);
CompositeFuture.all(authServiceDeploymentTracker.future(), notificationSenderDeploymentTracker.future(), amqpServerDeploymentTracker.future(), httpServerDeploymentTracker.future()).onSuccess(ok -> registerHealthCheckProvider(authenticationService)).compose(s -> healthCheckServer.start()).onSuccess(ok -> startup.complete(null)).onFailure(t -> startup.completeExceptionally(t));
startup.join();
}
use of org.eclipse.hono.util.WrappedLifecycleComponentVerticle in project hono by eclipse.
the class Application method doStart.
@Override
protected void doStart() {
if (!(authenticationService instanceof Verticle)) {
throw new IllegalStateException("Authentication service must be a vert.x Verticle");
}
LOG.info("adding common tags to meter registry");
meterRegistry.config().commonTags(MetricsTags.forService(Constants.SERVICE_NAME_DEVICE_REGISTRY));
LOG.info("deploying {} {} instances ...", appConfig.getMaxInstances(), getComponentName());
final CompletableFuture<Void> startup = new CompletableFuture<>();
// deploy authentication service (once only)
final Promise<String> authServiceDeploymentTracker = Promise.promise();
vertx.deployVerticle((Verticle) authenticationService, authServiceDeploymentTracker);
// deploy notification sender (once only)
final Promise<String> notificationSenderDeploymentTracker = Promise.promise();
vertx.deployVerticle(new WrappedLifecycleComponentVerticle(notificationSender), notificationSenderDeploymentTracker);
// deploy AMQP 1.0 server
final Promise<String> amqpServerDeploymentTracker = Promise.promise();
vertx.deployVerticle(() -> amqpServerFactory.newServer(), new DeploymentOptions().setInstances(appConfig.getMaxInstances()), amqpServerDeploymentTracker);
// deploy HTTP server
final Promise<String> httpServerDeploymentTracker = Promise.promise();
vertx.deployVerticle(() -> httpServerFactory.newServer(), new DeploymentOptions().setInstances(appConfig.getMaxInstances()), httpServerDeploymentTracker);
CompositeFuture.all(authServiceDeploymentTracker.future(), notificationSenderDeploymentTracker.future(), amqpServerDeploymentTracker.future(), httpServerDeploymentTracker.future()).onSuccess(ok -> registerHealthCheckProvider(authenticationService)).compose(s -> healthCheckServer.start()).onSuccess(ok -> startup.complete(null)).onFailure(t -> startup.completeExceptionally(t));
startup.join();
}
use of org.eclipse.hono.util.WrappedLifecycleComponentVerticle in project hono by eclipse.
the class Application method doStart.
@Override
protected void doStart() {
if (!(authenticationService instanceof Verticle)) {
throw new IllegalStateException("Authentication service must be a vert.x Verticle");
}
LOG.info("deploying {} {} instances ...", appConfig.getMaxInstances(), getComponentName());
final CompletableFuture<Void> startup = new CompletableFuture<>();
// deploy authentication service (once only)
final Future<String> authServiceDeploymentTracker = vertx.deployVerticle((Verticle) authenticationService).onSuccess(ok -> registerHealthCheckProvider(authenticationService));
// deploy AMQP 1.0 server
final Future<String> amqpServerDeploymentTracker = vertx.deployVerticle(this::amqpServer, new DeploymentOptions().setInstances(appConfig.getMaxInstances()));
// deploy notification receiver
final Future<String> notificationReceiverTracker = vertx.deployVerticle(new WrappedLifecycleComponentVerticle(notificationReceiver()));
CompositeFuture.all(authServiceDeploymentTracker, amqpServerDeploymentTracker, notificationReceiverTracker).compose(s -> healthCheckServer.start()).onSuccess(ok -> startup.complete(null)).onFailure(startup::completeExceptionally);
startup.join();
}
Aggregations