title: Kafka Streams state restoration on Exception
body: <p>With kafka streams we can do stateful operations. The state is kept local to the instance. This state is also backed up in a changelog topic, in case you lose your local state.</p>
  <p>I saw that full state restoration also happens in case of an unhandeled exception in the streams application. Even if you use persistent storage.  Imagine if you have terrabytes of state and due a nullpointer exception, kafka will begin with the restoration of this huge amount of data. This will be very time consuming.</p>
  <p>Why does kafka do a full restore of the state after an unhandled exception? Can we avoid this? Wrapping the code in a try-catch is not an option, because the message is then considered succesfully processed. We do some complex logic and also save some values in the state store.</p>