ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » AccessQueue() options

Post new topic  Reply to topic
 AccessQueue() options « View previous topic :: View next topic » 
Author Message
V&G
PostPosted: Sun Mar 26, 2006 6:20 am    Post subject: AccessQueue() options Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Sun Mar 26, 2006 7:23 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
V&G
PostPosted: Sun Mar 26, 2006 7:40 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sun Mar 26, 2006 9:41 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
V&G
PostPosted: Sun Mar 26, 2006 9:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Mon Mar 27, 2006 3:23 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
V&G
PostPosted: Mon Mar 27, 2006 5:38 am    Post subject: Reply with quote

Novice

Joined: 20 Oct 2005
Posts: 14

Thanks a lot to all taken a part.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » AccessQueue() options
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.