在两个SQS队列之间实现预定的门 [英] Implement a scheduled gate between two SQS queues

查看:120
本文介绍了在两个SQS队列之间实现预定的门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个SQS队列,分别是queueA和queueB. queueA已订阅了多个SNS主题,并不断收到消息. queueB是实际处理这些消息的人.

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.

但是我的要求是,该处理应该每天在固定时段(例如每天上午9点至下午6点)进行.

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

queueB内部无法控制/安排处理,换句话说,queueB在收到消息后立即对其进行处理.

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

我想在queueA和queueB之间建立一种门/门的机制. 此大门每天早上9点开放,一直开放到下午6点,恰好在下午6点关闭. 当门打开时,消息可以从队列A到队列B流动,包括在此期间到达队列A的消息,以及在关闭时间"到达并等待门打开的消息.

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.

推荐答案

执行此操作的方法有很多,但是您必须编写将消息从一个队列移动到另一个队列的过程-这应该很漂亮直截了当.为了使其更加灵活,请对该过程进行参数设置,以使其在指定的时间后停止.

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

这篇关于在两个SQS队列之间实现预定的门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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