I use WCF with netMsmqBinding. When the serviceHost is opened which scenario happens:
serviceHostregistered as listener to MSMQ – on each new arrived message to MSMQ, MSMQ will inform all it’s listeners.serviceHostwill poll MSMQ for new messages –
opening service host
using (var serviceHost = new ServiceHost(typeof(Service)))
{
serviceHost.Open();
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.ReadLine();
}
If the first scenario is true, how actually it registered to MSMQ. I didn’t found any articles that explain deeply how it happens. I would appreciate for any articles.
ServiceHost in this instance is a queue listener.
When a message is received onto the queue, the WCF stack causes your service operation to be called, passing the queue message into your service operation.
is not correct. If you have multiple listeners on the same queue then only one of them will get the message.