Show Table of Contents
6.7.5. Fairshare Feature
When using a priority queue, a velocity mismatch between message producers and consumers can result in lower priority messages remaining in the queue indefinitely. To ensure that messages of all priorities are serviced, the fairshare feature can be used to grab a predetermined number of messages for each priority level.
The
x-qpid-fairshare argument of the x-declare: argument can be used to enforce either a common number of messages to be grabbed per-priority-level, or a custom number of messages per-priority-level
The following example creates a queue with 10 priority levels, and will grab 5 messages from each priority in turn:
- C++
Sender sender = session.createSender('my-queue; {create: always, node:{x-declare:{arguments:{qpid.priorities:10, x-qpid-fairshare: 5}}}}')
The following example creates a queue with 10 priority levels, with custom fairshare amounts per-priority-level:
- C++
Sender sender = session.createSender('my-queue; {create: always, node:{x-declare:{arguments:{qpid.priorities:10, x-qpid-fairshare-0: 3, x-qpid-fairshare-1: 5, x-qpid-fairshare-2: 3, x-qpid-fairshare-3: 2, x-qpid-fairshare-4: 4, x-qpid-fairshare-5: 5, x-qpid-fairshare-6: 5, x-qpid-fairshare-7: 3, x-qpid-fairshare-8: 5, x-qpid-fairshare-9: 4, x-qpid-priorities: 10}}}}')

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.