Bogdanp / dramatiq_sqs

A Dramatiq broker that can be used with Amazon SQS.
https://dramatiq.io
Other
56 stars 21 forks source link

Add predefined queues support #14

Open eugeneyalansky opened 3 years ago

eugeneyalansky commented 3 years ago

Motivation:

In some environments creating new queues might be restricted, even though queue exists.

Issue:

The current implementation will declare a queue if it does not yet exist in Broker.queues and since Broker.queues initialized empty Broker.decalre_queue will always try to create the sqs queue.

I'd like to add support for already defined queues. By allowing to pass the queues attribute to the broker initialization can solve predefined queues issue.

If a new task with a new queue will be presented to the broker - the broker will still try to create a queue and it should give the desired result (Created queue in case of CreateQueue policy is granted, or Error that will describe the lack of permissions to do so)

Bogdanp commented 3 years ago

Sounds like a good idea to me. Feel free to open a PR and I'll take a look!