Implement a scheduled gate between two SQS queues

喜你入骨 提交于 2019-12-13 03:22:22

问题


I have two SQS queues say queueA and queueB. queueA has subscribed to mutliple SNS topics and keeps getting messages. queueB is the one to actually process these messages.

But my requirement is that this processing should happen everyday during a fixed period, say 9am to 6pm everyday.

There is no way to control/schedule processing inside queueB in other words, queueB processes the messages as soon as it recieves.

I want to have a gate/door sort of mechanism between queueA and queueB. This gate opens at 9am everyday, stays open till 6pm and closes exactly at 6pm. When the door is open, messages can flow from queueA to queueB including the messages that arrived in queueA during this period as well as messages arrived at 'closed time' and waiting for the gate to open.


回答1:


There are lots of ways to do this, but you'll have to write the process that moves messages from one queue to the other yourself - this should be pretty straightforward. To make it flexible, parameterize that process so it stops after a specified time.

Then, you can control this process via one of:

  • cron job on EC2
  • Scheduled Cloudwatch event
  • any other choice of scheduling tools


来源:https://stackoverflow.com/questions/53718017/implement-a-scheduled-gate-between-two-sqs-queues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!