Handling Kafka exceptions:
I have used the below handler to handle explicitly steams exception and replace the thread instead of shutdown the client.
//code snippet
public static class StreamsCustomUncaughtExceptionHandler implements StreamsUncaughtExceptionHandler {
@Override
public StreamThreadExceptionResponse handle(Throwable exception) {
log.error("Error message in StreamsCustomUncaughtExceptionHandler {}", exception.getMessage());
if (exception instanceof StreamsException) {
Throwable originalException = exception.getCause();
if (originalException.getMessage().equals("Retryable transient error")) {
return StreamThreadExceptionResponse.REPLACE_THREAD;
}
log.error("Error message instance of StreamsException {}", exception.getMessage());
}
return StreamThreadExceptionResponse.SHUTDOWN_CLIENT;
}
}```
Could someone suggest whether SHUTDOWN_KAFKA_STREAMS_CLIENT is valid option to handle the Kafka Exceptions like ClusterAuthorisationException from the spring boot code??