Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a tondem RecordFilterStrategy with MessageConverter. #3482

Open
ioanngolovko opened this issue Sep 13, 2024 · 0 comments
Open

Provide a tondem RecordFilterStrategy with MessageConverter. #3482

ioanngolovko opened this issue Sep 13, 2024 · 0 comments

Comments

@ioanngolovko
Copy link

Expected Behavior

Provide a tondem RecordFilterStrategy with MessageConverter.

Current Behavior

MessageConverter invokes after RecordFilterStrategy logic.

Context

If we configure MessageConverter (Json for example) -> then we expect to filter the converted Message, not just the deserialized ConsumerRecord (that is deserialized with String/Bytes/ByteArray SerDe). So for JsonDeserializer we must conver message inside our filter with our own logic, with ObjectMapper for example. It's dirty.

Filtering feature seems like incomplete due-to missing conjunction with Spring Messaging.

As you can see, here we try to filter original Consumer record and then invoke delegate logic.
https://github.com/spring-projects/spring-kafka/blob/3.2.x/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/FilteringMessageListenerAdapter.java#L71

Possible Solution

  • We must check if MessageConverter is configured for current MessageListenerContainer and build the right adapters chain
  • Refactor chain to allow new DelegatingFilterStrategy to decide what kind of data to filter, ConsumerRecord or Message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants