简体   繁体   English

SNS可以路由到多个SQS延迟队列之一吗?

[英]Can SNS route to one of multiple SQS delay queues?

SQS has delay queues that can add a delay before the message is delivered. SQS具有延迟队列 ,可以在传递邮件之前增加延迟。 However, they have a 120,000 cap on the total number of 'in flight' messages. 但是,他们在“飞行中”消息的总数上限为120,000。 The documentation recommends falling back to another queue when a client gets an OverLimit error. 该文档建议当客户端出现OverLimit错误时退回到另一个队列。

Is there any way to automatically fallback to another queue by the client publishing to a single SNS topic connected to several SQS delay queues? 通过客户端发布到连接到多个SQS延迟队列的单个SNS主题,是否有任何方法可以自动回退到另一个队列? By that, I mean that the message would generally be pushed from SNS to one of the SQS queues that has available 'in flight' capacity. 这样,我的意思是通常会将消息从SNS推送到具有可用“运行中”容量的SQS队列之一。

Are you actually worried about exceeding the 120,000 'in flight' messages, or are you possibly confusing that with the maximum queue size? 您实际上是在担心超过12万条“正在飞行”消息,还是可能将其与最大队列大小混淆? (of which there is none). (其中没有)。

There is no limit to the number of messages you can have in a queue, the 120,000 limit has to do with the number of messages where you queue consumers have requested messages to consume, but those messages have not yet been processed/deleted? 队列中可以容纳的消息数量没有限制,队列120,000的限制与您使用队列的使用者请求使用消息但尚未处理/删除的消息数量有关?

This is the defintion of 'in flight' from AWS: 这是AWS的“飞行中”定义:

Messages are inflight after they have been received from the queue by a consuming component, 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. 如果达到120,000的限制,您将收到Amazon SQS的OverLimit错误消息。 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. 您还可以增加用于处理消息的队列数。

Here is a link to confirm that the queue size itself has no limit: 这是一个确认队列大小本身没有限制的链接:

Q: How big can Amazon SQS queues be? 问: Amazon SQS队列有多大?

A: A single queue may contain an unlimited number of messages, and you can create an unlimited number of queues. 答:单个队列可能包含无限数量的消息,并且您可以创建无限数量的队列。

http://aws.amazon.com/sqs/faqs/#How_big_can_Amazon_SQS_queues_be http://aws.amazon.com/sqs/faqs/#How_big_can_Amazon_SQS_queues_be

My apologies ahead of time if you are NOT confusing the two issues - if thats the case and you really are talking about exceeding the 120K 'inflight' limit, I'll delete my post. 如果您没有将这两个问题混淆,我会提前道歉-如果是这样,并且您确实在谈论超过120K的“机上”限制,我将删除我的帖子。

By the way, found this question/answer, which will confirm for you that just because a message is in the delay queue, they are not 'in flight': 顺便说一句,找到了这个问题/答案,它将为您确认只是因为消息在延迟队列中,所以它们不在“运行中”:

Do Delay Queue messages count as "In Flight" in SQS? 延迟队列消息在SQS中是否算作“飞行中”?

Using SNS wouldn't help in this case, because a copy of the message posted to a SNS topic would be delivered to each SQS subscription. 在这种情况下,使用SNS将无济于事,因为张贴到SNS主题的消息的副本将传递给每个SQS订阅。

Some pointers that might help: 一些可能会有所帮助的指针:

Also, make sure you understand the difference pointed out in @EJ Brennan answer. 另外,请确保您了解@EJ Brennan答案中指出的区别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM