Working with MSMQ



Hi all,

In my earlier post about Application design, I was informed about the MSMQ.

Having never used MSMQ before, I have now done quite a bit of research. In
some respects, it seems almost perfect for what I need, but in others, I am
not so sure.

For example, for the reading of messages, most of the examples show just a
few seconds before retrieving messages with a timespan in the order of 2 or
3 seconds. Is this normal? The reason I ask is that the system I need to
develop can get VERY HEAVILY loaded at times and I think two or three
seconds is probably way too much time to waste. However, what I don't want
to do is to overload the system with checking for messages when there are

What would be a good compromise. I need a queueing system but I also need
near instant response when I can. (Near instant for example is to have
returned a response whilst still processing a thread, so in the order of

Something else the examples fail to do is to show which machine the messages
should be stored on. I am assuming local and that other machines that need
to act on the messages call the message from the local machine. Am I
assuming correctly?

The main use of the system I have to develop is an image interpretation
engine. Basically, the engine can interpret about 3000 parts of an image per
second. Sometimes there will be little for it to do, sometimes there could
be many thousand parts coming in all at once.

To scale this scenario, I would expect that we would just add processing
servers with the image interpreting engine installed.

The end application (that I am building) requires where possible that there
is a near instant response. We will be putting in logic to try and help with
the workload... we need an instant queue which will work on certain parts of
the image to validate the mandatory requirements, and a near-instant queue
that will handle the parts of the image that doesn't require the immediate

Is MSMQ what I need? If not, then what else could I use?

(I don't want to get bogged down with threads, though I think threads will
have a major role to play in this application. (When I say Bogged Down, I
mean that the machine is likely to suffer when there is a LOT of traffic
coming in.))

Best regards,
Dave Colliver.
~~ - Local franchises available




I would look into the more abstract WCF "IsOneWay" calls.
(which is a piggyback onto msmq).

Writing the polling code for MSMQ is a painful exercise. You have to keep
in mind that the DotNet System.Messaging stuff is just wrappers for COM
based msmq items.
(Don't believe, check the errorhandling of msmq)

WCF will help you avoid ALOT of plumbing code.

I don't know if WCF is best, but I wanted to at least introduce you to it:!A68482B9628A842A!158.entry
A full downloadable example is there. CHeck the IsOneWay example:

Here is some WCF MSMQ Binding and Behavior Hints


concerning the receiveErrorHandling, there are better options when we go to
MSMQ 4.0-->

<binding name="NoMSMQSecurity" exactlyOnce="true"
receiveErrorHandling="Fault" maxRetryCycles="5" retryCycleDelay ="00:00:30"
<security mode = "None">

<behavior name="DefaultThrottlingBehavior">
<serviceThrottling maxConcurrentCalls="20"
maxConcurrentInstances="25" />


The maxConcurrentCalls is NOT trivial to implment in a purely MSMQ fashion.
MS did the plumbing work much more nicely than you can roll you own IMHO.

MSQM (no wcf) tidbits:

You can check this msmq article out:





3.0 is an "addon" to 2.0, not a replacement.

Here are some hints:


Microsoft .NET Framework 3.0 Redistributable Package

(Please note that 3.0 is add-on components to 2.0, and not a replacement for
Visual Studio 2005 Service Pack 1 (SP1)
Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF), November
2006 CTP
Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow
Windows Update


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

MSMQ Permissions 3
XMLDocument and MSMQ 1
MSMQ group? 2
MSMQ & Multithreading 5
MSMQ and Transactions 1
MSMQ Trigger 3
MSMQ Design Question 3
StackTrace object and MSMQ 1