Deserialization Error Handling
Explore how to handle deserialization errors in Kafka Streams applications by using the DeserializationExceptionHandler interface. Understand the impact of default error handling, and learn how to configure built-in handlers to log errors and keep your stream processing resilient without shutting down the application.
Deserialization errors are common in Kafka Streams, especially during development, but we should be ready for them in production as well. They can occur when the structure of the incoming message is different than the one expected by the application.
The DeserializationExceptionHandler interface
For example, when our application expects a JSON and the incoming message is not a valid JSON string, an exception will be thrown from the deserializer class. Kafka Streams will catch this exception for us and will pass control to a special class that implements the DeserializationExceptionHandler interface, which has the following signature:
DeserializationHandlerResponse handle(final ProcessorContext context,final ConsumerRecord<byte[], byte[]> record,final Exception exception);
The ...