2

I am trying to implement the following,

  • Messages arrive at the Message broker with message priorities
  • They find their ways into various queues based on their message priority

So Q1 has messages with priority 1 Q2 has messages with priority 2 and so on ..

Is there a way to make the Message Broker process Q1 faster than the others.

  • Would it be possible to have a priority between queues ?
  • Q1 has higher priority to be processed than Q2 or better still processing of Q1 blocks other queues from being processed ?
  • Can an exchange itself be a priority queue that in turn feeds the other Queues ?
  • I saw that it is possible to extend the default exchanges via plugins, is there anything out there that already implements this above requirement that I have ?

Is this something feasible ? Or is this against the basic philosophy of a message broker ?

Is there any link to best practices while using prioritized messages ?

I did post this message on the Qpid nabble forum on August 28 - but 'This post has NOT been accepted by the mailing list yet'.

Thank you for your time.

caradees
  • 21
  • 2

1 Answers1

1

In qpid you can define a queue as a "priority queue".

session.createQueue(queueName;{create:always, node:{type:queue,
                    x-declare:{arguments:{'x-qpid-priorities':3}}}})

In a priority queue, a message with higher priority will leap frog over messages with lower priority and will be picked up earlier. You need not define separate queues for each priority level.

The x-qpid-priorities parameter specifies how many distinct priorities are supported by the queue.

Note though, priority based leapfrogging only works for consuming messages in a queue. Browsing doesn't respect priorities and you will see messages in the enqueue order.

Implementing separate queues for each priority isn't very useful, but if you insist on doing that, you will have to manage priority based consumption on your own. You can implement a consumer to check for messages in high priority queue, and then only check lower priority queue only if the first queue is empty.

RaGe
  • 22,696
  • 11
  • 72
  • 104