sharath Yogananda
sharath Yogananda

Reputation: 101

MQException 2046 error when getting messages from MQ queue

I am trying to get the messages from one local queue. I have initialized the queue manager , local queue from which I am supposed to fetch the messages .

Open Input options used for local queue

int openInputOptions = MQC.MQOO_OUTPUT ;               
 MQQueue outputQueue=queueManager.accessQueue(remoteQueue, openInputOptions);

and get message options is

MQGetMessageOptions gmo=new MQGetMessageOptions();
gmo.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
gmo.matchOptions=MQC.MQMO_NONE;

When I execute this I am getting

com.ibm.mq.MQException: Completion Code 2, Reason 2036 error .

Which states MQRC_NOT_OPEN_FOR_BROWSE

So I tried to use the below open option ,

int openInputOptions = MQC.MQOO_OUTPUT | MQC.MQOO_BROWSE;

When I try with this , it gives me error code Completion code 2, Reason 2046 error .

Upvotes: -1

Views: 4343

Answers (1)

Roger
Roger

Reputation: 7456

Is the queue actually local to the queue manager or are you trying to open a 'Remote Queue'. Because if it was a 'Local Queue' then the 'MQC.MQOO_BROWSE' option would work.

Upvotes: 0

Related Questions