public void OnMessage(IMessage message)
{
var textMsg = message as ITextMessage;
if(textMsg == null)
{
return;
}
msgCount--;
// just process the first message for 10 seconds to give some time main thread
// to restart ActiveMq broker
if(msgCount == MESSAGE_COUNT - 1)
{
Thread.Sleep(10000);
}
if(msgCount == 0)
{
// if all messages were consumed then we are fine
semaphore.Set();
}
}