You are missing the MQC.MQGMO_WAIT flag on MQGetMessageOptions.Options . Change it as follows:
getOptions = new MQGetMessageOptions {WaitInterval = MQC.MQWI_UNLIMITED, Options = MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING}
Please note that this will block the calling thread until the message arrives in the queue or any connection occurs. MQ has another client called the IBM Message Service Client (aka XMS.NET) that provides an implementation of the JMS specification in .NET. It has a cute little Message Listener that is automatically called whenever a message comes into the queue. Unlike the example above, the calling thread will not be blocked when using the Message Listener.
More about XMS.NET can be found here . Samples also come with MQ and for sample listening, please refer to the source file SampleAsyncConsumer.cs.
source share