I am making WCF calls over MSMQ in my application. There can be a scenario where the Queue is full and no more messages can be written.

How do we ensure that the Queue is not full before we make a WCF call which is using MSMQ



Re: Windows Communication Foundation (Indigo) handling MSMQ overflow in WCF

Sorin Alexander - MSFT

Hi Joby,

What is the scenario in which you expect the queue to be full In general, messages are not expected to remain in the queue for an extended period of time. Your service, while running, will continuously monitor the queue and receive any messages that are available. The only time this would not happen is when the service is down for maintenance.

If your scenario describes a continuous high volume of incoming messages, you might want to consider load balancing your service. Having multiple services would ensure continuous delivery of messages.

One other thing to note is that queues are generally used in situations where one-way communication is desired or required. The strength of queues lies in the fact that applications can send messages and then forget about them, without having to worry about a reply. The client that sends the message should never have to worry about the message not making it into the queue. If this is not the case, there is a greater design problem on the server side that should be addressed.

You can also change the queue quotas in MSMQ. You can modify this from the Computer Management window. The total limit is defined by the global limit storage found in the Message Queuing Properties General Tab. You can also set individual queue limits from their respective Properties windows.

Re: Windows Communication Foundation (Indigo) handling MSMQ overflow in WCF


Thanks Sorin,

You have almost got the problem.

The scenario is explained below.

We have one service continually pushing messages to the MSMQ. This is in fact a WCF method call (eg: Process(Message)). The other Service component who actually does this Process() takes some time to finish the processing. So Messages will be accumulated in the Queue over time. Due to some reasons, we have to stick to MSMQ as the channel. Load balancing is not suitable here as we need to maintain the processing of messages in it's incoming sequence.( ie, we cannot process second message before we process the first message").

So I am looking at a solution using which I can delay the Process(Message) call if there is no space in the queue. I also expect high volume of incoming messages. However we can afford to have a pause while pushing messages to the queue.