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

botocore.errorfactory.QueueNameExists when error_queue_name does not share a "prefix" with queue_name #43

Open
nimbusscale opened this issue Aug 15, 2020 · 1 comment

Comments

@nimbusscale
Copy link

nimbusscale commented Aug 15, 2020

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!

@jegesh
Copy link
Owner

jegesh commented Sep 4, 2021

I know it's been a year, but I'm trying to give this project a little attention now. If you don't mind explaining the issue better, it's not clear to me what the problem is you're running into

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

No branches or pull requests

2 participants