Skip to content

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

erizzo
Copy link

@erizzo erizzo commented Jun 18, 2025

📢 Type of change

  • Bugfix
  • [x ] New feature
  • Enhancement
  • Refactoring

📜 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

  • I reviewed submitted code
  • [x ] I added tests to verify changes
  • I updated reference documentation to reflect the change
  • [x ] All tests passing
  • No breaking changes

🔮 Next steps

@github-actions github-actions bot added the component: sqs SQS integration related issue label Jun 18, 2025
@erizzo erizzo changed the title Add SqqListenerFilter for use by the annotation processor Add SqsListenerFilter for use by the annotation processor Jun 18, 2025
Copy link
Contributor

@tomazfernandes tomazfernandes left a 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);
Copy link
Contributor

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))) {
Copy link
Contributor

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)
Copy link
Contributor

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?

@tomazfernandes
Copy link
Contributor

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: sqs SQS integration related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants