Azure Queue Message Priority

I have a queue in Azure storage called, for example, "messages". And every 1 hour, some services click on this queue for a certain number of messages that should update the data. But in some cases, I also click on this queue message from another place, and I want this message to be sent immediately, and I cannot set a priority for this message.

What is the best solution for this problem? Can I use two different queues (“messages” and “message priorities”), or is this a bad approach?

+7
azure azure-storage-queues
source share
1 answer

The correct approach is to use multiple queues - “normal priority” and high priority queues. We implemented several read threads in a queue in one working role - each thread first checks the high priority queue and, if it is empty, looks in a regular queue. Thus, high priority messages will be processed by the first available thread (almost immediately), and the same code will be executed regardless of where the messages come from. It also saves time when the reader is constantly looking in one line and needs to be dropped because there are rarely messages.

+7
source share

All Articles