我正在远程连接到服务器上的 MQ,并在我的机器上安装了 MQ 客户端 v6.0。我能够将消息放入队列,但我无法从同一个队列中获取消息,输出为“RC2033:MQRC_NO_MSG_AVAILABLE”
谁能帮我找到问题?
这会是由于队列的属性吗?
以下是我用来弹出消息的代码:
弹出消息:
queue = mqQMgr.AccessQueue("queue_name", MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INPUT_SHARED);
MQMessage queueMessage = new MQMessage();
queueMessage.Format = MQC.MQFMT_STRING;
MQGetMessageOptions queueGetMessageOptions = new MQGetMessageOptions();
queueGetMessageOptions.Options = MQC.MQGMO_WAIT;
queueGetMessageOptions.MatchOptions = MQC.MQMO_NONE;
queueGetMessageOptions.WaitInterval = 1000;
queue.Get(queueMessage, queueGetMessageOptions);
tbPoptxt.Text = "Message No" + count + ":" + queueMessage.ReadString(queueMessage.MessageLength);
推送代码
int optons = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;//Queue which opens with options output
queue = mqQMgr.AccessQueue("queue_name", optons);
MQMessage queueMessage = new MQMessage();
queueMessage.WriteString(tbPushtxt.Text.ToString());
queueMessage.Format = MQC.MQFMT_STRING;
MQPutMessageOptions queuePutMessageOptions = new MQPutMessageOptions();
queuePutMessageOptions.Options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_FAIL_IF_QUIESCING;
queue.Put(queueMessage, queuePutMessageOptions);
mqQMgr.Commit();
我正在使用相同的队列来放置消息和弹出消息