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 support for existing sqs queues #24

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

paudirac
Copy link
Contributor

@paudirac paudirac commented Oct 5, 2024

Motivation: Add support for existing sqs queues

The current broker implementation raises a botocore.errorfactory.QueueNameExists exception when the queue already exists. This PR tries to solve this replacing the call to sqs.create_queue with a call to a new internal method _get_or_create_queue that first tries to find the queue, and creates it when it doesn't exist. This avoids changing any logic in the declare_queue method.

The part I'm most unsure of is the extra efforts I need to put in the sqs stub for the tests, but they all are green now.

TD;DR

I don't know if this could be of any help. I came accross the same situation as @dvazar in: retech-us#1 and #14. Then I find out in #19 that the PR was not accepted. I see in the comments references to too much work on various PRs to review, but I'm not able to find out if I can help with something.

Actually, currently I'm following @Bogdanp advice in #19 (comment) and subclassed SQSBroker and to override declare_queues. We've done exactly this in one of our systems and it is working perfectly.

It was then that I thought about the PR. So this are my 2¢.

Feel free to point me to any direction I can help with this and I'll try to do my best. Also, I'll understand if this is not helping. In that case, feel free to discard it.

In any case, thanks a lot for the great work with dramatiq!

@paudirac paudirac changed the title Get or create queue Add support for existing sqs queues Oct 7, 2024
@paudirac paudirac marked this pull request as ready for review October 7, 2024 09:23
@Bogdanp Bogdanp merged commit dad71a3 into Bogdanp:master Oct 8, 2024
@Bogdanp
Copy link
Owner

Bogdanp commented Oct 8, 2024

Looks good, thanks!

@paudirac paudirac deleted the get-or-create-queue branch October 24, 2024 18:59
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 this pull request may close these issues.

2 participants