18 lines
6.2 KiB
HTML
18 lines
6.2 KiB
HTML
<html><head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>14. Health Indicator</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-stream.html" title="Spring Cloud Stream Reference Guide"><link rel="up" href="multi__preface.html" title="Part I. Preface"><link rel="prev" href="multi__testing.html" title="13. Testing"><link rel="next" href="multi_spring-cloud-stream-overview-metrics-emitter.html" title="15. Metrics Emitter"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">14. Health Indicator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__testing.html">Prev</a> </td><th width="60%" align="center">Part I. Preface</th><td width="20%" align="right"> <a accesskey="n" href="multi_spring-cloud-stream-overview-metrics-emitter.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="_health_indicator" href="#_health_indicator"></a>14. Health Indicator</h2></div></div></div><p>Spring Cloud Stream provides a health indicator for binders.
|
|
It is registered under the name <code class="literal">binders</code> and can be enabled or disabled by setting the <code class="literal">management.health.binders.enabled</code> property.</p><p>To enable health check you first need to enable both "web" and "actuator" by including its dependencies (see <a class="xref" href="">???</a>)</p><p>If <code class="literal">management.health.binders.enabled</code> is not set explicitly by the application, then <code class="literal">management.health.defaults.enabled</code> is matched as <code class="literal">true</code> and the binder health indicators are enabled.
|
|
If you want to disable health indicator completely, then you have to set <code class="literal">management.health.binders.enabled</code> to <code class="literal">false</code>.</p><p>You can use Spring Boot actuator health endpoint to access the health indicator - <code class="literal">/actuator/health</code>.
|
|
By default, you will only receive the top level application status when you hit the above endpoint.
|
|
In order to receive the full details from the binder specific health indicators, you need to include the property <code class="literal">management.endpoint.health.show-details</code> with the value <code class="literal">ALWAYS</code> in your application.</p><p>Health indicators are binder-specific and certain binder implementations may not necessarily provide a health indicator.</p><p>If you want to completely disable all health indicators available out of the box and instead provide your own health indicators,
|
|
you can do so by setting property <code class="literal">management.health.binders.enabled</code> to <code class="literal">false</code> and then provide your own <code class="literal">HealthIndicator</code> beans in your application.
|
|
In this case, the health indicator infrastructure from Spring Boot will still pick up these custom beans.
|
|
Even if you are not disabling the binder health indicators, you can still enhance the health checks by providing your own <code class="literal">HealthIndicator</code> beans in addition to the out of the box health checks.</p><p>When you have multiple binders in the same application, health indicators are enabled by default unless the application turns them off by setting <code class="literal">management.health.binders.enabled</code> to <code class="literal">false</code>.
|
|
In this case, if the user wants to disable health check for a subset of the binders, then that should be done by setting <code class="literal">management.health.binders.enabled</code> to <code class="literal">false</code> in the multi binder configurations’s environment.
|
|
See <a class="link" href="multi_spring-cloud-stream-overview-binders.html#multiple-systems" title="8.5 Connecting to Multiple Systems">Connecting to Multiple Systems</a> for details on how environment specific properties can be provided.</p><p>If there are multiple binders present in the classpath but not all of them are used in the application, this may cause some issues in the context of health indicators.
|
|
There may be implementation specific details as to how the health checks are performed. For example, a Kafka binder may decide the status as <code class="literal">DOWN</code> if there are no destinations registered by the binder.
|
|
For this reason, if you include a binder in the classpath, it is advised to use that binder by providing at least one binding (for E.g. through <code class="literal">EnableBinding</code>).
|
|
If you don’t have any bindings to provide for this binder, then that is an indication that you don’t need to include that binder in the classpath.</p><p>Lets take a concrete situation. Imagine you have both Kafka and Kafka Streams binders present in the classpath, but only use the Kafka Streams binder in the application code, i.e. only provide bindings using the Kafka Streams binder.
|
|
Since Kafka binder is not used and it has specific checks to see if any destinations are registered, the binder health heck will fail.
|
|
The top level application health check status will be reported as <code class="literal">DOWN</code>.
|
|
In this situation, you can simply remove the dependency for kafka binder from your application since you are not using it.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__testing.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="multi__preface.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="multi_spring-cloud-stream-overview-metrics-emitter.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">13. Testing </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-stream.html">Home</a></td><td width="40%" align="right" valign="top"> 15. Metrics Emitter</td></tr></table></div></body></html> |