parent
e17bbd179a
commit
616bada6f5
|
@ -476,7 +476,31 @@ The following table shows the default status mappings for the built-in statuses:
|
|||
|No mapping by default, so http status is 200
|
||||
|===
|
||||
|
||||
[[reactive-health-indicators]]
|
||||
==== ReactiveHealthIndicators
|
||||
For reactive applications, such as those using Spring WebFlux, ReactiveHealthIndicators provide a
|
||||
non-blocking contract for getting application health. Similar to traditional HealthIndicators,
|
||||
health information is collected from all {sc-spring-boot-actuator}/health/ReactiveHealthIndicator.{sc-ext}[`ReactiveHealthIndicator`]
|
||||
beans defined in your `ApplicationContext`. Spring Boot adds autoconfiguration for `RedisReactiveHealthIndicator`.
|
||||
Regular HealthIndicators that do not check against a reactive API are executed on the elastic scheduler.
|
||||
|
||||
To provide custom health information from a reactive API, you can register Spring beans that implement the
|
||||
{sc-spring-boot-actuator}/health/ReactiveHealthIndicator.{sc-ext}[`ReactiveHealthIndicator`] interface.
|
||||
The following code shows a sample `ReactiveHealthIndicator` implementation:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Component
|
||||
public class MyReactiveHealthIndicator implements ReactiveHealthIndicator {
|
||||
|
||||
@Override
|
||||
public Mono<Health> health() {
|
||||
return doHealthCheck() //perform some specific health check that returns a Mono<Health>
|
||||
.onErrorResume(ex -> Mono.just(new Health.Builder().down(ex).build())));
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
[[production-ready-application-info]]
|
||||
=== Application Information
|
||||
|
|
Loading…
Reference in New Issue