@Test void checkShouldReturnHealthyWhenRabbitMQIsRunning() { Result check = healthCheck.check().block(); assertThat(check.isHealthy()).isTrue(); }
@Override public Mono<Result> check() { try { return Flux.concat(connectionPool.tryConnection(), rabbitChannelPoolImpl.tryChannel()) .reduce(true, (a, b) -> a && b) .flatMap(channelOpen -> { if (channelOpen) { return checkVersion(); } else { return Mono.just(Result.unhealthy(COMPONENT_NAME, "The created connection was not opened")); } }) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e))); } catch (Exception e) { return Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e)); } }
RabbitMQHealthCheck implements HealthCheck { @Override public Mono<Result> check() { try { return Flux.concat(connectionPool.tryConnection(), rabbitChannelPoolImpl.tryChannel()) .reduce(true, (a, b) -> a && b) .flatMap(channelOpen -> { if (channelOpen) { return checkVersion(); } else { return Mono.just(Result.unhealthy(COMPONENT_NAME, "The created connection was not opened")); } }) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e))); } catch (Exception e) { return Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e)); } } }
RabbitMQHealthCheck implements HealthCheck { @Override public Mono<Result> check() { try { return Flux.concat(connectionPool.tryConnection(), rabbitChannelPoolImpl.tryChannel()) .reduce(true, (a, b) -> a && b) .flatMap(channelOpen -> { if (channelOpen) { return checkVersion(); } else { return Mono.just(Result.unhealthy(COMPONENT_NAME, "The created connection was not opened")); } }) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e))); } catch (Exception e) { return Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e)); } } @Inject  RabbitMQHealthCheck(SimpleConnectionPool connectionPool, ReactorRabbitMQChannelPool rabbitChannelPoolImpl); }
RabbitMQHealthCheck implements HealthCheck { @Override public Mono<Result> check() { try { return Flux.concat(connectionPool.tryConnection(), rabbitChannelPoolImpl.tryChannel()) .reduce(true, (a, b) -> a && b) .flatMap(channelOpen -> { if (channelOpen) { return checkVersion(); } else { return Mono.just(Result.unhealthy(COMPONENT_NAME, "The created connection was not opened")); } }) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e))); } catch (Exception e) { return Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e)); } } @Inject  RabbitMQHealthCheck(SimpleConnectionPool connectionPool, ReactorRabbitMQChannelPool rabbitChannelPoolImpl); @Override ComponentName componentName(); @Override Mono<Result> check(); }
RabbitMQHealthCheck implements HealthCheck { @Override public Mono<Result> check() { try { return Flux.concat(connectionPool.tryConnection(), rabbitChannelPoolImpl.tryChannel()) .reduce(true, (a, b) -> a && b) .flatMap(channelOpen -> { if (channelOpen) { return checkVersion(); } else { return Mono.just(Result.unhealthy(COMPONENT_NAME, "The created connection was not opened")); } }) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e))); } catch (Exception e) { return Mono.just(Result.unhealthy(COMPONENT_NAME, "Unhealthy RabbitMQ instances: could not establish a connection", e)); } } @Inject  RabbitMQHealthCheck(SimpleConnectionPool connectionPool, ReactorRabbitMQChannelPool rabbitChannelPoolImpl); @Override ComponentName componentName(); @Override Mono<Result> check();  }