/** * Register a liveness check procedure which succeeds if * the vert.x event loop of this protocol adapter is not blocked. * * @param handler The health check handler to register the checks with. * @see #registerEventLoopBlockedCheck(HealthCheckHandler) */ @Override public void registerLivenessChecks(final HealthCheckHandler handler) { registerEventLoopBlockedCheck(handler); }
/** * Registers additional health checks. * * @param provider The provider of the health checks. */ protected final void registerHealthchecks(final HealthCheckProvider provider) { healthCheckServer.registerHealthCheckResources(provider); } }
/** * Registers the readiness and liveness checks of the given service. * * @param serviceInstance instance of the service which's checks should be registered. */ @Override public void registerHealthCheckResources(final HealthCheckProvider serviceInstance) { serviceInstance.registerLivenessChecks(livenessHandler); serviceInstance.registerReadinessChecks(readinessHandler); }
private void givenAnAdapterConfiguredWithServiceClients( final Handler<Void> startupHandler, final Handler<Void> commandConnectionEstablishedHandler, final Handler<Void> commandConnectionLostHandler) { adapter = newProtocolAdapter(properties, "test", startupHandler, commandConnectionEstablishedHandler, commandConnectionLostHandler); adapter.setCredentialsServiceClient(credentialsService); adapter.setHonoMessagingClient(messagingService); adapter.setRegistrationServiceClient(registrationService); adapter.setTenantServiceClient(tenantService); adapter.setCommandConnection(commandConnection); }
/** * Exposes the health check server as a Spring bean. * * @return The health check server. */ @Bean public HealthCheckServer healthCheckServer() { return new VertxBasedHealthCheckServer(vertx(), applicationConfigProperties()); } }
/** * Starts up this service. * <ol> * <li>Registers an event bus consumer for {@linkplain #getEventBusAddress() * the service's event bus request address}.</li> * <li>Invokes {@link #doStart(Future)}.</li> * </ol> * * @param startFuture The future to complete on successful startup. */ @Override public final void start(final Future<Void> startFuture) { registerConsumer(); doStart(startFuture); }
/** * Adds message properties based on a device's registration information. * <p> * This methods simply invokes {@link #addProperties(Message, JsonObject, boolean)} with * with {@code true} as the value for the regAssertionRequired parameter. * * @param message The message to set the properties on. * @param registrationInfo The values to set. * @throws NullPointerException if any of the parameters is {@code null}. */ protected final void addProperties( final Message message, final JsonObject registrationInfo) { addProperties(message, registrationInfo, true); }
/** * Starts up this component. * <ol> * <li>invokes {@link #startInternal()}</li> * </ol> * * @param startFuture Will be completed if all of the invoked methods return a succeeded Future. */ @Override public final void start(final Future<Void> startFuture) { healthCheckServer.registerHealthCheckResources(this); startInternal().setHandler(startFuture.completer()); }
private AbstractProtocolAdapterBase<ProtocolAdapterProperties> newProtocolAdapter( final ProtocolAdapterProperties props, final String typeName, final Handler<Void> startupHandler) { return newProtocolAdapter(props, typeName, startupHandler, null, null); }
/** * Connects to a Hono Service component using the configured client. * * @param client The Hono client for the service that is to be connected. * @param serviceName The name of the service that is to be connected (used for logging). * @return A future that will succeed once the connection has been established. The future will fail if the * connection cannot be established. * @throws NullPointerException if serviceName is {@code null}. * @throws IllegalArgumentException if client is {@code null}. */ protected final Future<HonoClient> connectToService(final HonoClient client, final String serviceName) { return connectToService(client, serviceName, onConnect -> {}, onConnectionLost -> {}); }
private Future<Void> stopHealthCheckServer() { return healthCheckServer.stop(); }
@Override public void setConfig(final ServiceConfigProperties configuration) { setSpecificConfig(configuration); }
private static JsonObject newRegistrationAssertionResult(final String token) { return newRegistrationAssertionResult(token, null); }
/** * Registers the readiness and liveness checks of the given service if health check is configured, otherwise does * nothing. * * @param serviceInstance instance of the service which's checks should be registered. */ public void registerHealthCheckResources(final HealthCheckProvider serviceInstance) { if (router != null) { serviceInstance.registerLivenessChecks(livenessHandler); serviceInstance.registerReadinessChecks(readinessHandler); } // else: health check port not configured. }
/** * Starts up this service. * <ol> * <li>Registers an event bus consumer for {@linkplain #getEventBusAddress() * the service's event bus request address}.</li> * <li>Invokes {@link #doStart(Future)}.</li> * </ol> * * @param startFuture The future to complete on successful startup. */ @Override public final void start(final Future<Void> startFuture) { registerConsumer(); doStart(startFuture); }
/** * Adds message properties based on a device's registration information. * <p> * This methods simply invokes {@link #addProperties(Message, JsonObject, boolean)} with * with {@code true} as the value for the regAssertionRequired parameter. * * @param message The message to set the properties on. * @param registrationInfo The values to set. * @throws NullPointerException if any of the parameters is {@code null}. */ protected final void addProperties( final Message message, final JsonObject registrationInfo) { addProperties(message, registrationInfo, true); }
private AbstractProtocolAdapterBase<ProtocolAdapterProperties> newProtocolAdapter(final ProtocolAdapterProperties props) { return newProtocolAdapter(props, ADAPTER_NAME); }
/** * Register a liveness check procedure which succeeds if * the vert.x event loop of this protocol adapter is not blocked. * * @param handler The health check handler to register the checks with. * @see #registerEventLoopBlockedCheck(HealthCheckHandler) */ @Override public void registerLivenessChecks(final HealthCheckHandler handler) { registerEventLoopBlockedCheck(handler); }
/** * Registers additional health checks. * * @param provider The provider of the health checks. */ protected final void registerHealthchecks(final HealthCheckProvider provider) { healthCheckServer.registerHealthCheckResources(provider); } }
/** * Connects to a Hono Service component using the configured client. * * @param client The Hono client for the service that is to be connected. * @param serviceName The name of the service that is to be connected (used for logging). * @return A future that will succeed once the connection has been established. The future will fail if the * connection cannot be established. * @throws NullPointerException if serviceName is {@code null}. * @throws IllegalArgumentException if client is {@code null}. */ protected final Future<HonoClient> connectToService(final HonoClient client, final String serviceName) { return connectToService(client, serviceName, onConnect -> {}, onConnectionLost -> {}); }