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

KafkaListener parser doesn't count implemented interface annotations #7

Open
Unstopabul opened this issue Feb 5, 2024 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Unstopabul
Copy link

For example we have this generated listener interface:

//@KafkaListener(topics = "example_topic", groupId = "example_group")
public interface ExampleTopicExampleGroupListener {
@KafkaHandler
@KafkaHandlerDescription("example handler")
@KafkaHandlerTags(tags = { "example" })
@KafkaHandlerHeaders(headers = {
})
java.util.concurrent.CompletableFuture<ExampleOut> handleExampleIn(@Payload ExampleIn examplein, @Headers Map<String, String> headers);
}

If we create the implementation like below, the API won't generate the controller because it doesn't see the interface annotations (@KafkaHandler etc.):

@KafkaListener(topics = "example_topic", groupId = "example_group")
public class ExampleKafkaListener implements ExampleTopicExampleGroupListener {
@Override
public CompletableFuture<ExampleOut> handleExampleIn(ExampleIn examplein, Map<String, String> headers) {
return null;
}
}

So we have to repeat all annotations (method-level and parameter-level) for the API to start working:

@KafkaListener(topics = "example_topic", groupId = "example_group")
public class ExampleKafkaListener implements ExampleTopicExampleGroupListener {
@Override
@KafkaHandler
@KafkaHandlerDescription("example handler")
@KafkaHandlerTags(tags = { "example" })
@KafkaHandlerHeaders(headers = {
})
public CompletableFuture<ExampleOut> handleExampleIn(@PayloadExampleIn examplein,@HeadersMap<String, String> headers) {
return null;
}
}

location: pro/axenix_innovation/axenapi/processor/KafkaControllerProcessor.java -> method process -> <comment /* Find all methods with KafkaHandler annotation. Get DTO argument */> -> line:
List<? extends AnnotationMirror> list = this.processingEnv.getElementUtils().getAllAnnotationMirrors(element);

@SashaVolushkova SashaVolushkova added the bug Something isn't working label Feb 12, 2024
@SashaVolushkova SashaVolushkova added this to the Q1 of 2024 milestone Feb 12, 2024
@SashaVolushkova SashaVolushkova moved this from Todo to Done in AxenAPI Project Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants