Prioritize requests sent to services so that requests with a higher priority are received and processed more quickly than those with a lower priority.
When to use this pattern?
The System must handle multiple tasks that have different priorities
Different users or tenants should be served with different priority
Generally, all message queues support message prioritization. In case, the prioritization is not available in the selected message queue, then use this pattern where you haveto create 3 queues (High, mid, and low). The consumer will check the higher priority queue before processing the message from the lower queue.
Considerations
Priorities- decide after the discussion with the stakeholders.
Decide if all high-priority messages must be processed before any lower-priority messages
In the multiple queue approach; the consumer must ensure that it processes higher priority messages first.
If lower-priority messages need to be processed, you need to implement multiple pools of consumers. Create a dedicated pool to process the lower-priority messages at a slower pace to overcome the situation when high volume of higher-priority messages in the queue.
Monitoring
Cost - Additional cost to check all the queues every time.
Scalability - Dynamic scaling is required depending of the message volume.