Hello All
I have a problem with messaging (with MSMQ) which is a variation of fast producer/slow consumer. Is there a way to get outstanding unconsumed message count in a private MSMQ queue? I would like to use that to throttle the producer.
I would like to use a semaphore paradigm with MSMQ where the producer application will only send messages if the outstanding message count is less than a specified number.
Essentially, I would like to do something like the following
///Producer pseudo-code
public void SendMessage(Message message, int totalMessagesSentCounter)
{
if (totalMessagesSentCounter % 1000 == 0)
{
while (outgoingQueue.GetMessageCount() > X) ///Is this possible?
{
Sleep(Y milliseconds);
}
}
outgoingQueue.Send(Message);
totalMessagesSentCounter++;
}
My configuration : Win XP/2003 with MSMQ 3.0