MSMQ and multiple wcf-services on different servers reading from the very same queue

StackOverflow https://stackoverflow.com/questions/21302881

  •  01-10-2022
  •  | 
  •  

Pregunta

I'm aware of that there are a couple of posts here on SO that discusses this issue, but I can't figure out a straight answer to my scenario.

Lets say i have:

  1. One queue on Server-A with alot of messages coming in
  2. One WCF service with NetMsmq binding on Server-B reading from Server-A's queue
  3. The very same WCF Service deployed to another Server-C with the same binding reading from Server-A's queue

Am I guaranteed that the services on Server-B and Server-C will never process the same message?

Are there any other problems with this setup that needs to be taken care of?

The purpose of this setup with multiple wcf services reading from the same queue is to increase processing speed, and I do not want to use a hardware loadbalancer.

Thanks for your time!

¿Fue útil?

Solución

You will need to make your queue transactional and then set the exactlyOnce property on the binding to true.

Reference: http://msdn.microsoft.com/en-us/library/system.servicemodel.msmqbindingbase.exactlyonce(v=vs.110).aspx

This should take care of it. You can have multiple readers (WCF Services) reading from the same queue. That's basically a load-levelling concept and is the intent of queue-based messaging. Here is some background documentation on WCF and MSMQ.

http://msdn.microsoft.com/en-us/library/ms789048(v=vs.110).aspx

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top