Karan Verma
Karan Verma

Reputation: 1739

Amazon SQS Priority Queue

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?

Upvotes: 10

Views: 4687

Answers (2)

Pablo Cantero
Pablo Cantero

Reputation: 6357

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

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

Upvotes: 1

Nikhil
Nikhil

Reputation: 3152

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.

Upvotes: 6

Related Questions