What is the purpose of the Priority Queue in ServiceStack's RabbitMQ Server?


What is the purpose of the Priority Queue in ServiceStack's RabbitMQ Server?



I am using ServiceStack with the Rabbit MQ Server and found that service messages handled through the ServiceController.ExecuteMessage handler are processed with two threads even though "noOfThreads = 1". Here is how I am registering the handler:


container.Register<IMessageService>(c => new RabbitMqServer());
var mqServer = (RabbitMqServer)container.Resolve<IMessageService>();
mqServer.RegisterHandler<CallBatchMessage>(ServiceController.ExecuteMessage, noOfThreads: 1);



I found in the following about the Priority Queue in the documentation:



"Starting the MQ Server spawns 2 threads for each handler, one to listen to the Message Inbox mq:Hello.inq and another to listen on the Priority Queue located at mq:Hello.priorityq.



Note: You can white-list which messages to enable Priority Queue's for with mqServer.PriortyQueuesWhitelist or disable them all by setting mqServer.DisablePriorityQueues = true."



I would like only one thread to process the queue, so I used "mqServer.DisablePriorityQueues = true" and that worked. Now I am curious, what is the purpose of the Priority Queue?





Did you look at documentation? rabbitmq.com/consumer-priority.html
– labilbe
Aug 13 '14 at 13:33





@labilbe I am not sure that consumer priorities apply here, because ServiceStack is using a single consumer, the service. I don't understand how ServiceStack uses the ".priorityq" vs. the ".inq". How does the ".priorityq" end up processing messages from the ".inq"?
– jacksonakj
Aug 13 '14 at 20:13





If I'm not mistaken, it's the queue for "manual" messages, which are processed by the same handler in other stream.
– Victor Suzdalev
Aug 19 '14 at 14:56




1 Answer
1



It's not a normal priority queue as people expected.



The ServiceStack priority queue is just another work thread for another queue.



It will get well processed even the normal queue get too many messages and blocked.



You should only put a few important messages to the high priority queue.



If you put too many messages in the high priority queue, then it will be slower than the low priority queue.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

PHP contact form sending but not receiving emails