I am writing a C# application which reads a message from a queue on one QueueManager but potentially needs to write the response to a queue on a different queue manager. The QueueManager and QueueName to use for the response are defined as properties of the MQ Request message. Both QueueManagers are hosted by the same WebSphere MQ environment. i.e. What I need to do is use the same QueueManager instance that I used to read the request to write the reply (there may be many combinations of QueueManager/QueueName to write the response)
When building the response I have code of the form:
var ResponseQueue = RequestQueueManager.AccessQueue(RequestMessage.ReplyToQueueName, MQC.MQOO_OUTPUT,
RequestMessage.ReplyToQueueManagerName, null, null);
If the response queue manager is the same as the request queue manager, this all works, but if the responsequeue manager is different I get the error MQRC_UNKNOWN_REMOTE_Q_MGR, CompCode: 2, Reason: 2087.
I did find an article which suggested that I needed to set the MQOD properties of the response queue manager
MQOD.ObjectName=ResponseQueueName
MQOD.ObjectQMgrName= ResponseQueueManagerName
but I can't see how to do this in C#.
Any help would be much appreciated.