Deserialization Error Handling

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:

Get hands-on with 1400+ tech skills courses.