I have Sender and receiver console applications for IBM MQ XMS. The sender populates the Queue and the receiver dequeue the queue manger using receive method. I am using the while loop with bool value to keep running the receiver so that whenever a new message is available in the queue receiver can get that data. Now i want to change the receiver code to Asynchronous Message Listener instead of consumer.Receive(). The code snippet is,
consumerAsync = sessionWMQ.CreateConsumer(destination);
messageListener = new MessageListener(OnMessageCallBack);
consumerAsync.MessageListener = messageListener;
connectionWMQ.Start();
While(true)
{
console.writeline("Wait for message");
}
The above code fetches only the already available data and not the new one. For example if i have 2 data in my queue while starting the receiver application those messages getting downloaded. but when i keep the receiver application running and send a new data from sender app its not getting downloaded and i have to restart the receiver application to get that data. The similar scenario was working fine with synchronous mode consumer.ReceiveNoWait().
What am I missing?