【发布时间】:2015-10-07 19:24:25
【问题描述】:
我正在使用 .Net 侦听来自 IBM MQ 的消息。当它看到一条消息时,它会自动从队列中删除该消息。我想先检查消息的架构。如果它不是我正在寻找的正确模式,我想将它保留在队列中。
如何更改代码以在找到消息时不自动从队列中删除消息?
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING;
IBM.WMQ.MQQueueManager mqManager = new IBM.WMQ.MQQueueManager(qmName);
MQQueue queue = mqManager.AccessQueue(queueName, openOptions);
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.Options = MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_WAIT;
gmo.WaitInterval = MQC.MQWI_UNLIMITED;
queue.Get(message, gmo);
//Only remove message from the queue if a schema check of the message has passed
【问题讨论】: