Skip to content

ErrorHandlingDeserializer: should failedDeserializationFunction be mandatory? #2107

Open
@bencody

Description

@bencody

I took over maintenance of an application that uses Spring Kafka. My former colleague configured the application to make use of ErrorHandlingDeserializer, but he didn't configure a failedDeserializationFunction and didn't test what happens in case deserialization errors occur.

That application finally got deployed to a real testing environment, and the application's KafkaListener component kept getting records with null values. I couldn't figure out why the values were null. When looking at the data in the topic using the Kafka CLI tools, I saw that the records did have values. Other than those record value NPEs, there weren't any errors in the application logs.

After some time spent debugging, I found out that ErrorHandlingDeserializer is silently swallowing exceptions when failedDeserializationFunction isn't set, and it passes along null values.

Is this a good design? Would one ever want to use ErrorHandlingDeserializer without a failedDeserializationFunction, or should it be a mandatory field?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions