Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow @DltHandler Method to be Defined in a parent class of class annotated with @KafkaListener #3463

Closed
JooHyukKim opened this issue Aug 28, 2024 · 3 comments · Fixed by #3464

Comments

@JooHyukKim
Copy link
Contributor

Expected Behavior

@DltHandler-annotated method may be in the same class or parent class as the corresponding @KafkaListener annotation.

Current Behavior

@DltHandler-annotated method must be in the same class as the corresponding @KafkaListener annotation.

Context

My usecase is that all our consumer class have their own listener method annotated with @RetryableTopic and @KafkaListener to define per-class specificRetryableTopic.retryTopicSuffix property.
But all @DltHandler methods implementations are exactly the same.
So it would be nice to allow the suggested behavior.

@JooHyukKim
Copy link
Contributor Author

This sort of offshoot of #3183

@artembilan artembilan added this to the 3.3.0-M3 milestone Aug 28, 2024
@artembilan artembilan self-assigned this Aug 28, 2024
artembilan added a commit to artembilan/spring-kafka that referenced this issue Aug 28, 2024
Fixes: spring-projects#3463

Currently, a `@DltHandler`-annotated method must be in the same class as the corresponding `@KafkaListener` annotation.
Some logic might be really the same for different `@KafkaListener` services.

* Use `MethodIntrospector` in the `RetryableTopicAnnotationProcessor` to be able to process methods from super classes as well
@artembilan
Copy link
Member

@JooHyukKim ,

The proposal is here: #3464

Thank you for looking into this!

@JooHyukKim
Copy link
Contributor Author

LGTM, thank you for quick response!

sobychacko pushed a commit that referenced this issue Aug 28, 2024
Fixes: #3463

Currently, a `@DltHandler`-annotated method must be in the same class as the corresponding `@KafkaListener` annotation.
Some logic might be the same for different `@KafkaListener` services.

* Use `MethodIntrospector` in the `RetryableTopicAnnotationProcessor` to be able to process methods from super classes as well

**Auto-cherry-pick to `3.2.x` & `3.1.x`**
spring-builds pushed a commit that referenced this issue Aug 28, 2024
Fixes: #3463

Currently, a `@DltHandler`-annotated method must be in the same class as the corresponding `@KafkaListener` annotation.
Some logic might be the same for different `@KafkaListener` services.

* Use `MethodIntrospector` in the `RetryableTopicAnnotationProcessor` to be able to process methods from super classes as well

(cherry picked from commit 4dc0976)
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants