views:

237

answers:

1

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?

+2  A: 

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.

Mitch Wheat
Nice, thanks.I was concerned there might be some gotchas in the periphery.
Damovisa