You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/concern/kafka-sidecar/streams-health.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
3
3
When operating a Kafka sidecar that runs Kafka Streams applications, it is crucial to monitor the health of these streams. The `SidecarHealthHandler` provides a health check endpoint that verifies if all registered Kafka Streams instances are in `RUNNING` or `REBALANCING` state.
4
4
5
-
## Registering Kafka Streams
5
+
## Registering and Unregistering Kafka Streams
6
6
7
-
To enable health monitoring for your Kafka Streams application, you must verify that your streams instance is registered with the `KafkaStreamsRegistry`.
7
+
To enable health monitoring for your Kafka Streams application, you must verify that your streams instance is registered with the `KafkaStreamsRegistry`. You should also unregister it when the application shuts down.
The `SidecarHealthHandler` will automatically discover all registered streams and include them in the health check. If any registered stream is not in a healthy state, the health check endpoint will return `ERROR` (status 500 equivalent logic, though specifically returning a string).
26
26
27
+
To prevent the health check from returning an error during a graceful server shutdown, you should unregister the stream instance in your application's shutdown hook or `close()` method:
28
+
29
+
```java
30
+
// ... inside shutdown hook or LightStreams close() loop ...
0 commit comments