Efficient way to check whether SQS queue is empty

前端 未结 2 1819
死守一世寂寞
死守一世寂寞 2021-02-19 13:50

I have a SQS Queue from which messages are read by multiple hosts. I want to run some job (business logic) after all the messages in the queue have been processed.

2条回答
  •  [愿得一人]
    2021-02-19 14:33

    You could trigger your post business logic on the cloud watch metric related to queue depth. When the depth is 0 then you can send a SNS notification or start a lambda function.

    Also this cloud watch metric is better then others since this is actual message count reported by sqs service.

提交回复
热议问题