Amazon SQS优先队列 [英] Amazon SQS Priority Queue

查看:127
本文介绍了Amazon SQS优先队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Amazon简单排队服务创建优先级队列?

Is it possible to create a priority queue using the Amazon simple queuing service?

最初我在主题上找不到任何东西,这就是为什么我创建两个队列的原因.通用队列和优先级队列.我正在按照我定义的规则将消息排入此队列,但是在使消息出队时会产生混乱.

Initially I couldn't find anything on the subject and this is why I create two queues. A general queue and a priority queue. I am enqueuing messages to this queue according the rule I've defined but confusion arises while dequeuing messages.

如何对队列进行长时间轮询,以使队列组合像单个优先级队列一样?

How do I do a long poll on the queues such that my combination of queues behave like a single priority queue?

推荐答案

我认为通过创建两个队列-普通队列和优先级队列,您走在正确的轨道上.

I think you're on the right track by creating two queues - A normal queue and a priority queue.

在这种情况下,您不必进行长时间的民意测验.由于优先级队列中的消息优先于普通队列中的消息,因此您可以采用以下方法:

You don't necessarily need a long poll in this case. Since messages in the priority queue take precedence over messages in the normal queue, you could follow an approach like this:

  1. 轮询优先级队列,直到没有更多消息为止.
  2. 轮询普通队列,并在普通队列中的每条消息之后重复步骤1.

这篇关于Amazon SQS优先队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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