--- /dev/null
+package de.juplo.kafka;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.boot.actuate.health.Health;
+import org.springframework.boot.actuate.health.HealthIndicator;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@RequiredArgsConstructor
+public class ApplicationHealthIndicator implements HealthIndicator
+{
+ private final EndlessConsumer consumer;
+
+
+ @Override
+ public Health health()
+ {
+ try
+ {
+ return consumer
+ .exitStatus()
+ .map(Health::down)
+ .orElse(Health.outOfService())
+ .build();
+ }
+ catch (IllegalStateException e)
+ {
+ return Health.up().build();
+ }
+ }
+}