This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 5.0.
Amazon SQS传输- kombu.transport.SQS
¶
退让政策¶
退避策略使用SQS可见性超时机制来改变任务重试之间的时间差。该机制改变消息特定的 visibility timeout
从队列 Default visibility timeout
到策略配置的超时。重试次数由SQS管理(具体由 ApproximateReceiveCount
消息属性),并且用户不需要进一步的动作。
配置队列和退避策略::
broker_transport_options = {
'predefined_queues': {
'my-q': {
'url': 'https://ap-southeast-2.queue.amazonaws.com/123456/my-q',
'access_key_id': 'xxx',
'secret_access_key': 'xxx',
'backoff_policy': {1: 10, 2: 20, 3: 40, 4: 80, 5: 320, 6: 640},
'backoff_tasks': ['svc.tasks.tasks.task1']
}
}
}
backoff_policy
字典,其中key是重试次数,值是重试之间的延迟秒数(即SQS可见性超时) backoff_tasks
要应用上述策略的任务名称列表
上述政策:
Attempt |
Delay |
|
20秒 |
|
40秒 |
|
80秒 |
|
320秒 |
|
640秒 |