I have a Kafka Streams application (0.10.2.1). When I close the Kafka cluster, the streams application continues to wait for the next message, when the cluster is restored, it will resume message consumption. At a time when the cluster is disconnected, the application appears to work normally. I tested this for more than 45 minutes.
I would expect Kafka to make an exception or stop. I configured StateListenerto register when KafkaStreams shuts down, but it never gets called.
kafkaStreams.setStateListener((newState, _) => {
if (newState == KafkaStreams.State.NOT_RUNNING) {
Log.error("Kafka died unexpectedly.")
}
})
How do I get Kafka to throw an exception or exit when it cannot connect to the cluster?
Note: this assumes that the cluster goes into after when the application started
source
share