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

Add new QueueNotFoundStrategy #1143

Open
OmarTareefy opened this issue May 1, 2024 · 0 comments
Open

Add new QueueNotFoundStrategy #1143

OmarTareefy opened this issue May 1, 2024 · 0 comments
Labels
component: sqs SQS integration related issue type: enhancement Smaller enhancement in existing integration

Comments

@OmarTareefy
Copy link

OmarTareefy commented May 1, 2024

Type: Feature

Is your feature request related to a problem? Please describe.
Yes, currently in SqsMessageListenerContainerFactory there are two strategies to consider when a queue is not found, either CREATE or FAIL. In our business use case the CREATE will not be the best for us because we create the AWS queue with certain configurations and permissions and also we can't give the container running the application a create-queue permissions, in the other hand the FAIL strategy will not be good for us because in some cases the queue might not be created for that specific deployment and we would want the application to just start even if the queue is not there.

Describe the solution you'd like
It will be great if a new strategy is created called DO_NOTHING in QueueNotFoundStrategy enum where spring just ignores initializing the SqsMessageListenerContainerFactory for that SqsListener because the queue doesn't exist and the application start without issues.

Describe alternatives you've considered
I tagged my SQSConfig @configuration class with @ConditionalOnExpression(property == true) (this will be true by default) and created a spring bootstrap configuration class that pings the related queue using getQueueUrl and if that throws an exception (which means the queue is not there or the application doesn't have permissions) I set that property to false so that the SQSConfig @configuration class is turned off,

Another solution we considered is to set the autoStartup to false in the defaultSqsListenerContainerFactory and then at some point in the app startup, we get all of the containers from MessageListenerContainerRegistry and start them one by one, if the starting fails (because the queue is not created) we simply log an error and the app continues.

Please let me know if there is a better workaround or if there is a better solution for the issue I am facing that I am not aware of,
Thank you!

@maciejwalkowiak maciejwalkowiak added component: sqs SQS integration related issue type: enhancement Smaller enhancement in existing integration labels Sep 19, 2024
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 type: enhancement Smaller enhancement in existing integration
Projects
None yet
Development

No branches or pull requests

2 participants