不要延迟队列消息算作"在飞行"在SQS? [英] Do Delay Queue messages count as "In Flight" in SQS?

查看:245
本文介绍了不要延迟队列消息算作"在飞行"在SQS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作中,我打算用一个项目<一个href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-delay-queues.html"相对=nofollow>一个Amazon SQS延迟队列。

我有一点麻烦的理解究竟什么是飞行中的消息的意思。

还有就是文档中的一张纸条,上面写着:

  

注意

     

有一个120000限制每机舱的消息数   队列。已收到后,他们的消息机舱   排队,但尚未被删除从队列。如果到达   120000限制,您将收到来自亚马逊的超限错误信息   SQS。为了避免达到极限,你应该删除消息   从队列后,他们已被处理。您也可以增加   队列的数量,你用它来处理消息。

但我不完全知道什么被认为是接收队列。在流程图中,在这里是一个消息接收的队列?

我将有很多故意延迟(在图中的第一个蓝条),但不是很多,在可见性超时阶段(第二蓝色条)。

信息

一举两得蓝条被视为空中的消息?或者是一个消息只是飞行中后,已经(在图表的底部右侧的信息返回)接受由 ReceiveMessage 要求<? / P>

解决方案

这是被丢弃到延迟队列中的消息没有立即算作飞行,因为他们看不到任何消费者。他们不作为可用或飞行,他们只是不可见的给你。

您可以验证这一点的,简单的实验的AWS SQS控制台上:

  • 创建一个延迟队列,并且有两个选项卡中打开的SQS控制台。
  • 删除多条消息到延迟队列通过右键单击队列,然后选择发送消息 - 你应该注意到,这些消息不计为可用或飞行,直到延时结束,在这点,就会变为可用。

由于文件说,消息是飞行中,他们已收到之后(而他们正在通过一些应用程序处理的),但他们已被删除了。如果他们在应用程序已经跟他们说完不会被删除,他们返回到可用状态。

您可以验证这一点的,第二个实验中AWS SQS控制台上:

  • 开启两个选项卡的AWS SQS控制台。在延迟队列创建一些消息,并等待他们变得可用。
  • 在第一个选项卡,右键单击该队列,然后选择查看/删除邮件。在这个实验中,查看/删除消息对话框类似于应用程序 - 它是处理队列消息,而它正在观看它。设置轮询队列中的消息文本字段足够长的时间,并开始轮询消息。如果您提供的信息,他们应该立即出现。
  • 在第二个选项卡,刷新SQS控制台。你应该注意到,这些消息是现在的飞行,因为消息已经在查看他们在其他选项卡中被接收。

由于您的飞行中消息是psently由你的应用程序处理$ P $的消息,该列中的消息队列深度不宜现实变得非常大。处理它们后删除邮件(或retry->妥善处理,然后删除/移动到另一个队列来处理除外),你应该没问题。

I'm working on a project in which I intend to use an Amazon SQS Delay Queue.

I'm having a bit of trouble understanding exactly what is meant by "inflight" messages.

There is a note in the documentation that says:

Note

There is a 120,000 limit for the number of inflight messages per queue. Messages are inflight after they have been received by the queue, but have not yet been deleted from the queue. If you reach the 120,000 limit, you will receive an OverLimit error message from Amazon SQS. To help avoid reaching the limit, you should delete the messages from the queue after they have been processed. You can also increase the number of queues you use to process the messages.

But I'm not entirely sure what is considered being "received by the queue." In the flow diagram, where is a message "received" by the queue?

I will have a lot of messages purposely delayed (in the first blue bar of the diagram) but not many in the "visibility timeout" phase (second blue bar).

Do both blue bars count as "inflight" messages? Or is a message only "inflight" after it has been "received" by a ReceiveMessage request (to the right of "Message returned" at the bottom of the chart)?

解决方案

Messages that are dropped into a Delay Queue are not immediately counted as "In Flight", since they are invisible to any consumers. They aren't counted as "Available" or "In Flight", they just aren't visible to you.

You can verify this with a simple experiment on the AWS SQS console:

  • Create a delay queue, and have two tabs open to the SQS console.
  • Drop several messages into the delay queue by right clicking the queue and selecting "Send a Message" -- you should notice that these messages aren't counted as "Available" or "In Flight" until the delay expires, at which point they become "Available."

As the documentation says, messages are "In Flight" after they have been received (while they are being handled by some application) but before they have been deleted. If they are not deleted when the application has finished with them, they return to an "Available" state.

You can verify this with a second experiment on the AWS SQS console:

  • Open two tabs to the AWS SQS console. Create some messages in your delay queue and wait for them to become available.
  • In your first tab, right click the queue and select "View/Delete Messages". In this experiment, the "View/Delete Messages" dialog is analogous to your application -- it is handling the queue message while it is viewing it. Set the "Poll queue for messages" text field to an adequately long duration and start polling for messages. If your messages are available, they should appear immediately.
  • In your second tab, refresh the SQS console. You should notice that these messages are now "In Flight", as the messages have been received while you are viewing them in the other tab.

Since your "In Flight" messages are messages that are presently being handled by your application, the queue message depth in that column shouldn't realistically grow very large. Delete your messages after handling them (or retry->appropriately handle then delete/move to another queue to process on an exception) and you should be okay.

这篇关于不要延迟队列消息算作&QUOT;在飞行&QUOT;在SQS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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