芹菜与亚马逊 SQS [英] Celery with Amazon SQS

查看:27
本文介绍了芹菜与亚马逊 SQS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Amazon SQS 作为 芹菜.Celery 依赖于 Kombu 的 SQS 传输实现.但是没有足够的文档来使用它,所以我找不到如何在 Celery 上配置 SQS.有没有人在 Celery 上成功配置过 SQS?

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 for using it, so I cannot find how to configure SQS on Celery. Is there somebody that had succeeded to configure SQS on Celery?

推荐答案

我多次遇到这个问题,但仍然不完全确定如何设置 Celery 以与 SQS 一起工作.事实证明,使用最新版本的 Kombu 和 Celery 很容易.作为另一个答案中提到的 BROKER_URL 语法的替代方案,您可以简单地设置传输、选项、用户和密码,如下所示:

I ran into this question several times but still wasn't entirely sure how to setup Celery to work with SQS. It turns out that it is quite easy with the latest versions of Kombu and Celery. As an alternative to the BROKER_URL syntax mentioned in another answer, you can simply set the transport, options, user, and password like so:

BROKER_TRANSPORT = 'sqs'
BROKER_TRANSPORT_OPTIONS = {
    'region': 'us-east-1',
}
BROKER_USER = AWS_ACCESS_KEY_ID
BROKER_PASSWORD = AWS_SECRET_ACCESS_KEY

这解决了 URL 解析器的一个据称问题,该问题不允许在您的 API 密钥中使用正斜杠,这在 AWS 中似乎很常见.由于似乎还没有关于该主题的大量信息,我还在此处写了一篇关于该主题的简短博客文章:

This gets around a purported issue with the URL parser that doesn't allow forward slashes in your API secret, which seems to be a fairly common occurrence with AWS. Since there didn't seem to be a wealth of information out there about the topic yet, I also wrote a short blog post on the topic here:

http://www.caktusgroup.com/blog/2011/12/19/using-django-and-celery-amazon-sqs/

这篇关于芹菜与亚马逊 SQS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆