Celery with Amazon SQS

前端 未结 7 1497
星月不相逢
星月不相逢 2020-11-30 20:11

I want to use Amazon SQS as broker backed of Celery. There’s the SQS transport implementation for Kombu, which Celery depends on. However there is not enough documentation f

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-30 20:46

    I'm using Celery 3.0 and was getting deprecation warnings when launching the worker with the BROKER_USER / BROKER_PASSWORD settings.

    I took a look at the SQS URL parsing in kombo.utils.url._parse_url and it is calling urllib.unquote on the username and password elements of the URL.

    So, to workaround the issue of secret keys with forward slashes, I was able to successfully use the following for the BROKER_URL:

    import urllib
    BROKER_URL = 'sqs://%s:%s@' % (urllib.quote(AWS_ACCESS_KEY_ID, safe=''),
                                   urllib.quote(AWS_SECRET_ACCESS_KEY, safe=''))
    

    I'm not sure if access keys can ever have forward slashes in them but it doesn't hurt to quote it as well.

提交回复
热议问题