Do Delay Queue messages count as “In Flight” in SQS?

风格不统一 提交于 2019-12-05 04:36:11

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.

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