@@ -8,15 +8,18 @@ permalink: /priority
88---
99
1010Queue prioritization ensures that critical tasks are handled before lower-priority
11- ones. Rqueue supports two modes of priority handling:
11+ ones. Rqueue supports three modes of priority handling:
1212
13131 . ** Weighted** : Polling frequency is based on numeric weights assigned to queues.
14- 2 . ** Strict** : Higher-priority queues are always polled first.
14+ 2 . ** Strict** : Higher-priority queues are polled first, but starvation is considered
15+ so lower-priority queues still get polling opportunities.
16+ 3 . ** Hard Strict** : Messages are always fetched from the highest-priority queue first,
17+ moving top-down only when that queue has no available message.
1518
1619### Configuring Priority
1720
1821To enable priority handling:
19- - Set ` priorityMode ` in the container factory to ` STRICT ` or ` WEIGHTED ` .
22+ - Set ` priorityMode ` in the container factory to ` WEIGHTED ` , ` STRICT ` , or ` HARD_STRICT ` .
2023- Use the ` priority ` field in the ` @RqueueListener ` annotation to assign weights or levels.
2124- Use the ` priorityGroup ` field to group multiple related queues. By default, queues with
2225 specified priorities are added to a default group.
@@ -49,19 +52,32 @@ For implementation details, see [WeightedPriorityPoller][WeightedPriorityPoller]
4952
5053### Strict Priority
5154
52- In strict mode, the poller always attempts to fetch messages from the highest-priority
53- queue first .
55+ In strict mode, the poller prefers the highest-priority queue first, but it also
56+ considers starvation so every queue continues to get polling chances over time .
5457
5558- The poller starts with Q1.
5659- If Q1 is empty, it moves to Q2, then Q3.
57- - If a queue is empty, it becomes inactive for the duration of the
60+ - If a queue is empty, it becomes inactive for the duration of the
5861 ** polling interval** .
59- - To prevent total starvation of lower-priority queues, inactive queues become
60- eligible for polling again after a maximum of 1 minute, even if higher-priority
61- queues still have work.
62+ - If messages are not fetched from a lower-priority queue for a certain interval,
63+ that queue becomes eligible again so it can be polled even while higher-priority
64+ queues continue to receive traffic.
65+ - This gives lower-priority queues a chance to make progress and prevents permanent
66+ starvation.
6267
6368For implementation details, see [ StrictPriorityPoller] [ StrictPriorityPoller ] .
6469
70+ ### Hard Strict Priority
71+
72+ In hard strict mode, the poller always follows a top-down priority order.
73+
74+ - The poller starts with the highest-priority queue.
75+ - It continues to fetch from that queue as long as messages are available.
76+ - It moves to the next queue only when the current higher-priority queue has no
77+ message available.
78+ - This approach keeps the queue order fully top-down and may starve lower-priority
79+ queues while higher-priority queues continue to receive traffic.
80+
6581### Additional Configuration
6682
6783* ** ` rqueue.add.default.queue.with.queue.level.priority ` ** : Determines if a "default"
0 commit comments