I'm new in IBM MQ. Using the following code I can easily put a message in a queue and get that message.
public void QueuePut()
{
queue = queueManager.AccessQueue("Q1", MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);
MQMessage message = new MQMessage();
message.WriteString("stackoverflow");
MQPutMessageOptions putMessageOptions = new MQPutMessageOptions();
putMessageOptions.Options += MQC.MQPMO_ASYNC_RESPONSE;
queue.Put(message, putMessageOptions);
}
public void QueueGet()
{
queue = queueManager.AccessQueue("Q2", MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING);
MQMessage gotMessage = new MQMessage();
queue.Get(gotMessage);
string str = message.ReadString(gotMessage.MessageLength);
}
You can easily see I'm writing a message to 'Q1' and reading it from 'Q2' since Q1 is alias queue
Now, the thing I want is to get information about the message that I got in the QueueGet function. What I want to know is that gotMessage comes from 'Q1' even If I'm reading it in 'Q2'.
Here is the related MQ property from the IBM documentation:
I'm unable to test this because I don't have all the required components to test this but I believe, this should work: