Skip to content

RecordFilterStrategy don't allow to use child classes of the record value #787

@Kirill380

Description

@Kirill380

I have a base class for Kafka events that inherited by specific DTO events classes related to a particular topic.
When I tried to filter Kafka events by RecordFilterStrategy parametrized with the base class I found out that I can't set up KafkaListenerContainerFactories parametrized with child DTO classes using this filter. I looked into the source code of the filter class and I figured out that the filter method doesn't use upper-bounded wildcard generic for ConsumerRecord so it means I can put only exactly the same type but not its successors.
It is better to use bounded generics to allow to put child classes.

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