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

Missing Support for @AliasFor in meta-annotations for @KafkaListener #812

Closed
clo-vis opened this issue Sep 25, 2018 · 0 comments · Fixed by #817
Closed

Missing Support for @AliasFor in meta-annotations for @KafkaListener #812

clo-vis opened this issue Sep 25, 2018 · 0 comments · Fixed by #817
Assignees
Milestone

Comments

@clo-vis
Copy link

clo-vis commented Sep 25, 2018

With the meta-annotation bellow

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@KafkaListener
public @interface Listener {
  @AliasFor(annotation = KafkaListener.class, attribute = "topics")
  String[] value();
}

the following method is correctly recognized as a KafkaListener BUT without the attribute "topics" set.

@Listener("someTopic")
void myMethod(@Payload String msg) { ... } 

Consequently, an IllegalArgumentException is thrown:
12:25:50.058 [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.IllegalArgumentException: An array of topicPartitions must be provided
at org.springframework.util.Assert.notEmpty(Assert.java:361)
at org.springframework.kafka.listener.config.ContainerProperties.(ContainerProperties.java:196)

@garyrussell garyrussell self-assigned this Oct 1, 2018
@garyrussell garyrussell added this to the 2.2.GA milestone Oct 1, 2018
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Oct 1, 2018
Resolves spring-projects#812

Allow user annotations meta-annotated with `@KafkaListener` to set alias properties.
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Oct 1, 2018
Resolves spring-projects#812

Allow user annotations meta-annotated with `@KafkaListener` to set alias properties.

Also fix exception text when no topic/partition info provided.
artembilan pushed a commit that referenced this issue Oct 1, 2018
Resolves #812

Allow user annotations meta-annotated with `@KafkaListener` to set alias properties.

Also fix exception text when no topic/partition info provided.

* Add docs.
denis554 added a commit to denis554/spring-kafka that referenced this issue Mar 27, 2019
Resolves spring-projects/spring-kafka#812

Allow user annotations meta-annotated with `@KafkaListener` to set alias properties.

Also fix exception text when no topic/partition info provided.

* Add docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants