When creating queues via CloudFormation you can allow the queue names to be generated automatically. For example a template with these resources:
MailDeadLetterQueue:
Type: AWS::SQS::Queue
MailQueue:
Type: AWS::SQS::Queue
Properties:
ReceiveMessageWaitTimeSeconds: 20
RedrivePolicy:
deadLetterTargetArn: !Sub ${MailDeadLetterQueue.Arn}
maxReceiveCount: 3
Generates two queues named StackName-MailQueue-UPCWLGTA34SP and StackName-MailDeadLetterQueue-1TD3W1IE8HV2C.
Currently, the codebase only looks for queues that match the queue name as a prefix.
https://github.com/nimbusscale/python-sqs-listener/blob/master/sqs_listener/__init__.py#L80
Given we are passing the exact queue names to SqsListener, I'd like to update the code so that it looks for each queue individually. Something like this:
sqs = self._session.client('sqs', region_name=self._region_name, endpoint_url=self._endpoint_name, use_ssl=ssl)
try:
self._queue_url = sqs.get_queue_url(QueueName=self._queue_name)['QueueUrl']
mainQueueExists = True
except sqs.exceptions.QueueDoesNotExist:
mainQueueExists = False
try:
self._error_queue_url = sqs.get_queue_url(QueueName=self._error_queue_name)['QueueUrl']
errorQueueExists = True
except sqs.exceptions.QueueDoesNotExist:
errorQueueExists = False
This is just to get the concept apart, I realize that there needs to be support for when AWS_ACCOUNT_ID env var is set and there may be a few other changes to match the rest of the code as well. I'll submit a complete PR assuming this sounds like a direction you are OK with and this project is still active (which it seems to be).
Thanks!
When creating queues via CloudFormation you can allow the queue names to be generated automatically. For example a template with these resources:
Generates two queues named
StackName-MailQueue-UPCWLGTA34SPandStackName-MailDeadLetterQueue-1TD3W1IE8HV2C.Currently, the codebase only looks for queues that match the queue name as a prefix.
https://github.com/nimbusscale/python-sqs-listener/blob/master/sqs_listener/__init__.py#L80
Given we are passing the exact queue names to
SqsListener, I'd like to update the code so that it looks for each queue individually. Something like this:This is just to get the concept apart, I realize that there needs to be support for when
AWS_ACCOUNT_IDenv var is set and there may be a few other changes to match the rest of the code as well. I'll submit a complete PR assuming this sounds like a direction you are OK with and this project is still active (which it seems to be).Thanks!