How to clear the issue “com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2040”

被刻印的时光 ゝ 提交于 2019-12-11 07:17:18

问题


I have used the below code to inhibit the queue but when I try to inhibit I got the error.
I have tried various open options for the particular queue but still i have the issue. what else i missed in my code;

     public void control(String mgrName, String queueName, int openOptions, string option)throws MQException{
     qMgr = new MQQueueManager(mgrName);
       mqQueue = qMgr.accessQueue(queueName, openOptions);    
       if (option.equalsIgnoreCase("stop")){
            System.out.println("Stop mesage received");
             mqQueue.setInhibitGet(MQC.MQQA_GET_INHIBITED);
             System.out.println("Queue inhibitted successfully");
        }else if(option.equalsIgnoreCase("start")){
            System.out.println("Start mesage received");
            mqQueue.setInhibitGet(MQC.MQQA_GET_ALLOWED);
            System.out.println("Queue get allowed successfully");
        }
}

I have got the below Error when call this method.
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2040


回答1:


2040 = MQRC_NOT_OPEN_FOR_SET. The IBM v7.5 Knowledge center page "2040 (07F8) (RC2040): MQRC_NOT_OPEN_FOR_SET" describes the reason for this error:

Explanation

An MQSET call was issued to set queue attributes, but the queue had not been opened for set.

Programmer response

Specify MQOO_SET when the object is opened.

If the openOptions passed to control included MQOO_SET then the error should go away.

Example below:

int openOptions = MQConstants.MQOO_FAIL_IF_QUIESCING | MQConstants.MQOO_SET


来源:https://stackoverflow.com/questions/42360699/how-to-clear-the-issue-com-ibm-mq-mqexception-mqje001-completion-code-2-reas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!