I am connecting remotely to MQ on the server and i installed MQ client v6.0 on my machine. I am able to put the message into the queue but i am unable to get the message from the same queue the output is "RC2033: MQRC_NO_MSG_AVAILABLE"
Can anyone please help me to find the issue?
Will this be due to properties of the queue?
The following is the code which i am using to pop the message :
Pop Message:
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);
PUSH CODE
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();
I am using same queue for putting a message and poping a message
Look in the samples directory for the nmqsput and nmqsget c# examples - these do exactly what you are after and are good working examples.
Looking at the code above, I do not think there is a problem getting the message, followed up by your comment that amqsputc failed to find a message as well. I think the problem is on the putting side.
This may sound a silly question, but how do you know the message is there. What is the curdepth after the put? Look at the queue status - are there any uncommitted messages? (One thing I've seen before is putting under a unit of work (syncpoint) and then not committing and then another application trying to get it.