不连续地从IBM MQ Queue读取消息

本文关键字:Queue 读取 消息 MQ IBM 不连续 | 更新日期: 2023-09-27 18:08:40

当我在一个导入队列中有2000条消息时,当我像这样读取它

MQQueue mqQueue = null; 
MQQueueManager mqQMgr=null;  
try
{
  //Create connection to queue manager
   mqQMgr = new MQQueueManager("Queue Manager name", properties);
  //Access the queue
    mqQueue = mqQMgr.AccessQueue(QueueName, MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE);
   for(int i=1;i<2000;i++)
  {
    //read the messages
    mqMsg=new MQMessage();
    mqQueue.Get(mqMsg);
  }
}
catch(MQException mqe)
{  
  //If no messages in the queue , break. (if not, catch any error)
}
finally
{
     mqQueue.Close(); //Close the MQ Queue
     mqQMgr.Disconnect(); //Disconnect the MQ Manager
}

每次读取时,管理器随机处理,例如前800条消息,然后抛出

"MQRC_HANDLE_NOT_AVAILABLE"(比较代码:2,原因代码:2017).

我没有在上面的代码段关闭队列/管理器吗?请分享你的想法,以便处理所有的信息。我通过MQ.net类使用7.5 MQ客户机。日志文件包含以下信息。

AMQ9051: WebSphere MQ找不到安全策略定义。说明:安全策略定义没有定义。动作:必须定义安全策略定义

不连续地从IBM MQ Queue读取消息

我尝试了您的示例代码片段并为我工作得很好。我没有看到2017年的错误。

错误日志中的条目可能与您的问题有关。您是否为队列设置了安全策略,并期望将已签名/已签名& &;加密的消息放入/放入/取出队列?也许与IBM建立一个ticket/PMR是值得的。