Amazon SQS Priority Queue

醉酒当歌 提交于 2020-01-03 08:13:07

问题


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?


回答1:


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. Poll priority queue till there are no more messages.
  2. Poll normal queue and repeat step 1 after every message in the normal queue.



回答2:


You could use Shoryuken and set a higher weight to configure the priority:

queues:
  - [high_priority_queue, 5]
  - [low_priority_queue, 1]


来源:https://stackoverflow.com/questions/22494357/amazon-sqs-priority-queue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!