I want to create a priority queue that has internal prioritization in order to first assign higher priority messages using ServiceStack. The ServiceStack RedisMQ implementation provides a long set of priorities on its IMessage interface. I would expect a message sent with a higher value in the Priority property to slip out of the queue first. My tests show that a message with Priority> 0 is placed in Redis "Mq: MyDto.priorityq", and any other value places the message in a normal state in the queue "Mq: MyDto.inq".
This is a sample code illustrating what I'm trying to execute:
using (var producer = MsgFactory.CreateMessageProducer())
{
var lowPrioMsg = new Message<MyDto>(lowPrioDto);
lowPrioMsg = (long)1;
producer.Publish<MyDto>(lowPrioMsg);
var highPrioMsg = new Message<MyDto>(highPrioDto);
highPrioMsg.Priority = (long)100;
producer.Publish<MyDto>(highPrioMsg);
}
In other words, I want highPrioMsg with priority = 100 to go before lowPrioMsg with priority = 1. In practice, however, these messages seem to follow the consistent FIFO principle.
Is there a way to set up a ServiceStack RedisMQ to work, as I expect, with internal prioritization in PriorityQueue?
Or is my only choice - either use a regular queue or a priority queue? In this case, why is long used for the Priority installer instead of a boolean?
source
share