我正在尝试使用AWS的SNS和SQS实现粉丝架构。就像本文https://betterprogramming.pub/how-to-fan-out-to-different-sqs-queues-using-sns-message-过滤-84CD23ED9D07
在上面的文章中,他有一个我想避免的全部队列。假设我有一个主题t和两个队列Q1和Q2订阅。 Q1接受“狗”,Q2接受“猫”。
我的问题是:
- 如果有人与马发布一条消息会发生什么?
- 如何处理任何队列都没有接收的消息? SNS DLQ最终会传达马消息吗?还是会丢弃它?
谢谢
I am trying to implement a fanout architecture using AWS' SNS and SQS. There will be a FIFO topic and several FIFO queues subscribed to it each having its own filtering policies just like in this article https://betterprogramming.pub/how-to-fan-out-to-different-sqs-queues-using-sns-message-filtering-84cd23ed9d07
In the article above he has a catch-all queue which I want to avoid. Lets assume I have a topic T and two queues Q1 and Q2 subscribed to it. Q1 accepts "dogs" and Q2 accepts "cats".
My questions are:
- If someone publishes a message with a horse what would happen?
- How can I handle a message that is not being picked up by any of the queues? Will SNS DLQ get the horse message eventually or will it be discarded?
Thank you
发布评论
评论(1)
将消息发送到Amazon SNS主题时,然后将其发送给所有订户。如果队列上没有订户,则没有人会收到该消息。
来自:
因此,如果没有订阅接受消息,那么它与没有订阅者相同 - 没有人会收到消息。
请注意,消息不是“通过SQS队列接收”。相反,SNS主题将消息的副本转发给订户。无论是否发送一个订户,该消息都不会影响其他订户是否已发送消息。
来自:
因此,Amazon SNS Dead Letter队列仅用于具有交付失败的消息。它们不用于“没有订户想要的消息”。
When a message is sent to an Amazon SNS Topic, it is then sent to all subscribers. If there are no subscribers on the queue, then nobody will receive the message.
From Amazon SNS subscription filter policies - Amazon Simple Notification Service:
Thus, if no subscription accepts the message, then it is the same as having no subscribers -- nobody will receive the message.
Please note that messages are not "picked up by the SQS queues". Rather, the SNS Topic forwards a copy of the message to the subscribers. Whether or not one subscriber is sent the message has no impact on whether other subscribers are sent the message.
From Amazon SNS dead-letter queues (DLQs) - Amazon Simple Notification Service:
Thus, Amazon SNS Dead Letter Queues are only used for messages that have a delivery failure. They are not used for 'messages that no subscriber wanted'.