Author |
Message
|
V&G |
Posted: Sun Mar 26, 2006 6:20 am Post subject: AccessQueue() options |
|
|
Novice
Joined: 20 Oct 2005 Posts: 14
|
Hello all,
I'm trying to read queue content on remote MQ manager using .NET API..
The scenario is:
- to write the message to remote queue "aR" on manager "A". As a parameters of message I specify "ReplyToQueueName" as "bL" and "ReplyToQueueManagerName" as "B".
- to read reply message from local queue "bL" on manager "B".
Code: |
public virtual void PutMessage(MemoryStream message, String sendToQueueName, String replyToQMagagerName, String replyToQName)
{
try
{
IBM.WMQ.MQQueue requestQueue = m_mqMgr.AccessQueue(sendToQueueName, MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_OUTPUT);
IBM.WMQ.MQMessage requestMessage = new IBM.WMQ.MQMessage();
requestMessage.Write(message.ToArray(), 0, (int)message.Length);
requestMessage.ReplyToQueueName = replyToQName;
requestMessage.ReplyToQueueManagerName = replyToQMagagerName;
requestQueue.Put(requestMessage);
m_mqMgr.Commit();
requestQueue.Close();
}
catch (IBM.WMQ.MQException e)
{
throw new MQException(e.Message, e);
}
}
public MemoryStream GetMessage(String replyToQName, String replyToQMng)
{
try
{
IBM.WMQ.MQQueue replyQueue = m_mqMgr.AccessQueue(replbyToQName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING, replyToQMng, null, null);
IBM.WMQ.MQMessage replyMessage = new IBM.WMQ.MQMessage();
IBM.WMQ.MQGetMessageOptions mqGetMsgOpts = new IBM.WMQ.MQGetMessageOptions();
mqGetMsgOpts.WaitInterval = -1;
mqGetMsgOpts.Options = MQC.MQGMO_WAIT;
replyQueue.Get(replyMessage, mqGetMsgOpts);
m_mqMgr.Commit();
replyQueue.Close();
return new MemoryStream(replyMessage.ReadBytes(replyMessage.DataLength));
}
catch (IBM.WMQ.MQException e)
{
throw new MQException(e.Message, e);
}
}
|
The call for AccessQueue() in GetMessage() cause exception with code MQRC_OPTION_NOT_VALID_FOR_TYPE.
What options should I specify to get the goal?
Thanks ahead |
|
Back to top |
|
 |
wschutz |
Posted: Sun Mar 26, 2006 7:23 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
If "replyToQMng" is the name of the qmgr you are connected to, then you don't really need to specify it on the accessqueue call. if it isn't the same qmgr, then you can't open a queue defintion on a different qmgr for "input". _________________ -wayne |
|
Back to top |
|
 |
V&G |
Posted: Sun Mar 26, 2006 7:40 am Post subject: |
|
|
Novice
Joined: 20 Oct 2005 Posts: 14
|
Is it mean that in order to get queue definition on other qmgr I need to connect to it firstly?
I guess it's not a case otherwise I don't understand the sense of replyToQMng parameter...
Can you give me a correct usage example of AccessQueue() function with 5 parameters? |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Mar 26, 2006 9:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
The purpose in filling a reply to qmgr with a qmgr name different from your own is to initiate a process and send the result somewhere else for evaluation by a different process.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
V&G |
Posted: Sun Mar 26, 2006 9:48 pm Post subject: |
|
|
Novice
Joined: 20 Oct 2005 Posts: 14
|
In other words I can open queue on other qmgr for OUTPUT only, is it right? |
|
Back to top |
|
 |
wschutz |
Posted: Mon Mar 27, 2006 3:23 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
V&G wrote: |
In other words I can open queue on other qmgr for OUTPUT only, is it right? |
Yes, that is correct. You can only open LOCAL queues for input. _________________ -wayne |
|
Back to top |
|
 |
V&G |
Posted: Mon Mar 27, 2006 5:38 am Post subject: |
|
|
Novice
Joined: 20 Oct 2005 Posts: 14
|
Thanks a lot to all taken a part. |
|
Back to top |
|
 |
|