Working with MSMQ

D

David

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
none.

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
milliseconds)

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
work.

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.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
S

sloan

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:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!158.entry
A full downloadable example is there. CHeck the IsOneWay example:


Here is some WCF MSMQ Binding and Behavior Hints

<bindings>


<!--See
http://msdn.microsoft.com/en-us/library/system.servicemodel.receiveerrorhandling.aspx
concerning the receiveErrorHandling, there are better options when we go to
MSMQ 4.0-->

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

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

</behavior>
</serviceBehaviors>
</behaviors>



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:
http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx

Or
http://microsoft.apress.com:80/aspt...aded-msmq-engine-running-as-a-windows-service
 
S

sloan

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

Here are some hints:



------------------------

Microsoft .NET Framework 3.0 Redistributable Package
http://www.microsoft.com/downloads/...0b-f857-4a14-83f5-25634c3bf043&DisplayLang=en

(Please note that 3.0 is add-on components to 2.0, and not a replacement for
2.0)
------------------------
Visual Studio 2005 Service Pack 1 (SP1)
http://msdn2.microsoft.com/en-us/vstudio/bb265237.aspx
------------------------
------------------------
Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF), November
2006 CTP
http://www.microsoft.com/downloads/...37-cc86-4bf5-ae44-f5a1e805680d&DisplayLang=en
------------------------
Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow
Foundation)
http://www.microsoft.com/downloads/...9E-1FA3-48CF-8023-E8F38E709BA6&displaylang=en
------------------------
Windows Update
http://www.update.microsoft.com/windowsupdate/v6/default.aspx?ln=en-us
 

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

Top