Microsoft Message Queue - priority flag or a separate queue?
Asked Answered
M

2

6

I've implemented a system in C# that uses the Microsoft Message Queue (System.Messaging) for communication between related processes. Essentially, a number of Sender services generate messages to put in the queue and a number of Receiver processes watch the queues and grab those messages when they arrive.

I've just been told that there are some messages that will need priority over others.

Messages are likely to come in waves, and there could potentially be occasions where a very large number of messages are put in the queue in one hit (say a thousand or so), so there could be a delay before the final message gets processed.

My original thought was to have a second Priority message queue which is also watched by each of the Receiver processes in a different thread. There'd be far fewer messages in this queue so there'd be less delay.

Then I stumbled across the Message.Priority property.

So:

Should I use this Priority flag rather than implementing another queue? Will it successfully and efficiently jump these messages ahead of the rest? If so, what conditions and side effects are there likely to be if any?

Or should I stick with my original plan and implement another queue for priority messages?

Mab answered 27/3, 2009 at 0:21 Comment(0)
N
5

Should I use this Priority flag rather than implementing another queue? Yes.

Will it successfully and efficiently jump these messages ahead of the rest? Yes.

If so, what conditions and side effects are there likely to be if any? None, MSMQ was designed to work this way.

Nearby answered 27/3, 2009 at 0:30 Comment(1)
Nice, thanks. I was concerned there might be some gotchas in the periphery.Mab
H
3

Apparently message priority isn't needed - http://www.udidahan.com/2008/01/30/podcast-message-priority-you-arent-gonna-need-it\ . Udi talks about a few different possible architectures and ways to set up your infrastructure using multiple endpoints instead of using msmq message priority. He also mentions that turning on message priority will increase the memory usage on the servers.

Holmquist answered 6/6, 2011 at 13:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.