다음을 통해 공유


Single Reader for MSMQ

My application needs to process messages from a queue in-order but multiple messages are being read at once. How do I make the service only use a single reader?

There are two modes that control how many requests a service can process at once. InstanceContextMode controls when a new instance of your service is created; ConcurrencyMode controls the threading model for the service.

When the InstanceContextMode is PerCall (or PerSession- the two are the same if you don't actually have a session), multiple instances of your service will be created with their own reader thread, up to a limit on the number of simultaneous instances.

When the ConcurrencyMode is Multiple, multiple reader threads will be passing messages to a service instance, up to a limit on the number of simultaneous calls.

If you want your service to be sequentially invoked with each of the messages in the queue, then you need to set both InstanceContextMode and ConcurrencyMode to Single.

Next time: Getting Caught by Loopback

Comments

  • Anonymous
    March 20, 2008
    The other day I talked about the built-in service validation behaviors but these behaviors are only a