How to get messages receive count in Amazon SQS using boto library in Python?

前端 未结 5 1925
不知归路
不知归路 2021-02-09 00:29

I am using boto library in Python to get Amazon SQS messages. In exceptional cases I don\'t delete messages from queue in order to give a couple of more changes to recover tempo

5条回答
  •  忘了有多久
    2021-02-09 01:00

    aws has in-built support for this, just follow the below steps:

    1. create a dead letter queue
    2. enable Redrive policy for the source queue by checking "Use Redrive Policy"
    3. select the dead letter queue you created in step#1 for "Dead Letter Queue"
    4. Set "Maximum Receives" as "3" or any value between 1 and 1000

    How it works is, whenever a message is received by the worker, the receive count increments. Once it reaches "Maximum Receives" count, the message is pushed to the dead letter queue. Note, even if you access the message via aws console, the receive count increments.

    Source Using Amazon SQS Dead Letter Queues

提交回复
热议问题