Kafka Streams app does NOT fail when the Kafka cluster goes down

Viewed 867

I have a Kafka Streams app running (0.10.2.1). When I shut down the Kafka cluster the streams app continues to wait for the next message, when the cluster is brought back up, it will resume consuming messages. For the duration that the cluster is down the app appears to be working fine. I have tested this for over 45 minutes.

I would expect Kafka to throw an exception or stop. I have configure a StateListener to log when KafkaStreams shuts down, however it is never invoked.

kafkaStreams.setStateListener((newState, _) => {
  if (newState == KafkaStreams.State.NOT_RUNNING) {
    Log.error("Kafka died unexpectedly.")
  }
})

How do I get Kafka to throw an exception or shutdown when it cannot connect to the cluster?

Note: this assumes that cluster goes down after the app has started

1 Answers
Related