Priority for specific Message possible

I have about 10 message classes that are processed via Azure ServiceBus and the Messaging library of SS.
However, some of these classes should be prioritised. For example, I have one message that is sending emails, but I would like to give lower prio to them.
So I have a class that I want to be processed ASP even though in the Mail message queue are hundreds of messages waiting.
Is this possible?

Each Message gets their own thread to process that message which can be configured to be processed by multiple threads when registering the message with RegisterHandler<T>(handler,noOfThreads).

The worker threads are independent, i.e. the thread of one message doesn’t interrupt or get used to process another message.

In addition each Message by default is configured with 2 handlers, one to process messages sent to the standard .inq and a handler to process messages sent to the .priorityq which can be sent with a Priority > 0, e.g:

mqProducer.Publish(new Message<MyRequest>(request) {
    Priority = 1
});

Which is a different message processing channel you can use to expedite processing of the same message by having it processed by an independent worker thread.

1 Like