title: Spring Boot: Kafka health indicator
body: <p>I have something like below which works well, but I would prefer checking health without sending any message, (not only checking socket connection).  I know Kafka has something like KafkaHealthIndicator out of the box, does someone have experience or example using it ?</p>
  <pre><code>   public class KafkaHealthIndicator implements HealthIndicator {
     private final Logger log = LoggerFactory.getLogger(KafkaHealthIndicator.class);
  
     private KafkaTemplate&lt;String, String&gt; kafka;
  
     public KafkaHealthIndicator(KafkaTemplate&lt;String, String&gt; kafka) {
     this.kafka = kafka;
     }
  
    @Override
    public Health health() {
    try {
       kafka.send(&quot;kafka-health-indicator&quot;, &quot;❥&quot;).get(100, TimeUnit.MILLISECONDS);
    } catch (InterruptedException | ExecutionException | TimeoutException e) {
        return Health.down(e).build();
    }
    return Health.up().build();
   }
  }
  </code></pre>