I want to create a priority queue that has internal prioritization so that higher prioritized messags get popped first using ServiceStack. The ServiceStack RedisMQ implementation provides a Priority setter of type long on its IMessage interface. I would expect that message sent with a higher value on the Priority property would get popped first from the queue. My tests show that a message with Priority > 0 gets put on Redis "Mq:MyDto.priorityq" while any other value put the message on the normal in queue "Mq:MyDto.inq".
This is some sample code illustrating what I'm trying to accomplish:
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 the highPrioMsg with Priority=100 to be popped before the lowPrioMsg with Priority=1. In practice, however, these message seem to follow a sequential FIFO principle.
Is there a way I can configure ServiceStack RedisMQ to work as I expect with internal Prioritization in the PriorityQueue?
Or is my only choice to either use the normal queue or the priority queue? In that case, why is a long used for the Priority setter instead of a boolean?