为什么SQS中的roxAgeOfOldestMessage不大于大约5分钟 [英] Why is ApproximateAgeOfOldestMessage in SQS not bigger than approx 5 mins

查看:223
本文介绍了为什么SQS中的roxAgeOfOldestMessage不大于大约5分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java中的Spring Cloud AWS消息传递( 2.0.1.RELEASE )从SQS队列中使用。如果相关,我们使用默认设置,即Java 10和spring cloud Finchley.SR2

I am utilising spring cloud aws messaging (2.0.1.RELEASE) in java to consume from an SQS queue. If it's relevant we use default settings, java 10 and spring cloud Finchley.SR2,

我们最近遇到了一个问题由于应用程序错误导致无法处理消息的情况,导致出现异常且未确认(删除)消息。大概是在可见性超时时间过去之后(再次使用默认值),稍后将重试该消息(这是所希望的),我们未在此处自定义设置。

We recently had an issue where a message could not be processed due to an application bug, leading to an exception and no confirmation (deletion) of the message. The message is later retried (this is desirable) presumably after the visibility timeout has elapsed (again default values are in use), we have not customised the settings here.

几天来我们都没有发现错误,这意味着消息接收计数很高,并且从概念上讲,消息已经排队了一段时间(几次)天前)。我们考虑过创建一个云监视SQS警报,以提醒我们将来出现类似情况。唯一合适的指标似乎是 roximategegeoldoldestmessage

We didn't spot the error above for a few days, meaning the message receive count was very high and the message had conceptually been on the queue for a while (several days by now). We considered creating a cloud watch SQS alarm to alert us to a similar situation in future. The only suitable metric appeared to be ApproximateAgeOfOldestMessage.

可悲的是,在观察该指标时,我会看到:

Sadly, when observing this metric I see this:

最大年龄不会超过5分钟(尽管我知道它已经存在了几天)。如果每次收到消息时消息都变旧,假设没有收到确认并且消息未删除-而是在可见性超时过去之后又变得可用,该图应该不会高很多吗?

The max age doesn't go much above 5 mins (despite me knowing it was several days old). If a message is getting older each time a receive happens, assuming no acknowledgment comes and the message isn't deleted - but is instead becoming available again after the visibility timeout has elapsed should this graph not be much much higher?

我不知道这是否是春季云aws消息消费消息的特定方式,还是一般的SQS怪癖,但我的期望是是否放了一条消息5天前的队列中,并且使用者没有成功使用该消息,那么最长期限是5天?

I don't know if this is something specific to thew way that spring cloud aws messaging consumes the message or whether it's a general SQS quirk, but my expectation was that if a message was put on the queue 5 days ago, and a consumer had not successfully consumed the message then the max age would be 5 days?

实际上是这样一种情况吗:如果消费者收到一条消息,但最终并未删除该消息,则该消息的最大使用期限实际上是两次消费呼叫之间的时间长度?

Is it in fact the case that if a message is received by a consumer, but not ultimately deleted that the max age is actually the length between consume calls?

任何人都可以确认我的期望是否不正确,即,这确实是SQS预期的行为方式(它不认为年龄是自消息首先被放入队列中,而是认为它是两次接收呼叫之间的时间?

Can anyone confirm whether my expectation is incorrect, i.e. this is indeed how SQS is expected to behave (it doesn't consider the age to be the duration of time since the message was first put on the queue, but instead considers it to be the time between receive calls?

推荐答案

基于 AWS论坛上的类似问题,这显然是一个错误常规SQS队列仅影响单个消息。

Based on a similar question on AWS forums, this is apparently a bug with regular SQS queues where only a single message is affected.

为了对此问题产生有用的警报,我建议设置一个死信队列(其中,可配置的无删除消耗数),并警告死信队列的大小(roximatenumb) erOfMessagesVisible)。

In order to have a useful alarm for this issue, I would suggest setting up a dead-letter-queue (where messages get automatically delivered after a configurable number of consume-without-deletes), and alarm on the size of the dead-letter-queue (ApproximateNumberOfMessagesVisible).

这篇关于为什么SQS中的roxAgeOfOldestMessage不大于大约5分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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