-
-
Notifications
You must be signed in to change notification settings - Fork 337
Add SqsListenerFilter for use by the annotation processor #1416
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @erizzo!
Left a few comments, let me know what you think.
@FunctionalInterface | ||
public interface SqsListenerFilter { | ||
|
||
boolean createEndpoint(SqsListener annotation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps shouldCreateEndpoint
?
protected Endpoint createEndpoint(SqsListener sqsListenerAnnotation) { | ||
if (filters.stream().anyMatch(f -> !f.createEndpoint(sqsListenerAnnotation))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this logic would be better placed in the AbstractListenerAnnotationBeanPostProcessor
, since it's not an SQS-specific logic.
@@ -125,6 +126,7 @@ protected void detectAnnotationsAndRegisterEndpoints(Object bean, Class<?> targe | |||
} | |||
annotatedMethods.entrySet().stream() | |||
.map(entry -> createAndConfigureEndpoint(bean, entry.getKey(), entry.getValue())) | |||
.filter(Objects::nonNull) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not filter the endpoints here, before the map
method?
@erizzo, we just merged a PR with a few changes to the annotation BPP, please rebase your branch and take a look at the changes. Thanks and looking forward to seeing this feature evolve! |
📢 Type of change
📜 Description
In a discussion about skipping certain
@SqsListener
annotation at runtime, it was suggested to provide a more convenient mechanism for applications. This is a suggested implementation of that idea.💡 Motivation and Context
💚 How did you test it?
📝 Checklist
🔮 Next steps