设计你的应用程序来处理FIFO亚马逊SQS [英] Designing your app to handle FIFO in Amazon SQS

查看:139
本文介绍了设计你的应用程序来处理FIFO亚马逊SQS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从亚马逊SQS常见问题页面:

From the Amazon SQS FAQ page:

亚马逊SQS不保证FIFO访问亚马逊的消息   SQS队列主要是因为亚马逊的分布式特性,   SQS。如果您需要特定的消息排序,你应该设计自己的   应用程序来处理它。

Amazon SQS does not guarantee FIFO access to messages in Amazon SQS queues, mainly because of the distributed nature of the Amazon SQS. If you require specific message ordering, you should design your application to handle it.

我的问题是 - 怎样才能设计应用程序的方式。

My question is - How does one design the application that way?

推荐答案

您可以设置一个消息序列计数器,同时发送消息。在接收端,可以随时处理邮件,如果顺序是正确的。如果发生失序消息来了,等到合适的消息出现(在那之前存储邮件列表中的排序序列号),然后处理正确的顺序消息,而另一些进来的。

You can set a message sequence counter while sending message. At receiving end, you can keep processing messages if sequence is right. In case an out of sequence message comes, wait till the right message comes (till then store messages in a list sorted by seq no.) and then process right sequence message and others which came in between.

这篇关于设计你的应用程序来处理FIFO亚马逊SQS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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