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 Java / JMS » RFHUtil default queue open parameters

Post new topic  Reply to topic
 RFHUtil default queue open parameters « View previous topic :: View next topic » 
Author Message
cherubiel
PostPosted: Fri Mar 11, 2011 6:44 am    Post subject: RFHUtil default queue open parameters Reply with quote

Newbie

Joined: 01 Jun 2010
Posts: 9
Location: ZION

Hello,

I am able to read from, write to and browse queues on Remote Queue Managers using RFHUtil in Client mode. However, when I attempt to do something similar using a standalone Java program, it exits with the following return code -

Quote:
MQJE001: Completion Code 2, Reason 2058


So I assume its the queue open options that aren't working. I'm currently using -

Code:
MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_INQUIRE


This works well for local queues.

I want to know the default options used by RFHUtil to do a read from a remote queue so that I can use the same in the Java program. Am I on the right path?? HELP!

Vinay[/quote]
_________________
Signed with a picture of grapes on the branch
~VRT
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 11, 2011 7:00 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

What part of the description of MQRC 2058, which is MQRC_Q_MGR_NAME_ERROR makes you think it is caused by the open options?
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Mar 11, 2011 7:16 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Technically, you cannot read (get from) a remote queue, you can connect to a remote queue manager and access a local queue on that QM.

Are you sure you have used client mode and not binding mode to connect to MQ?


Last edited by zpat on Fri Mar 11, 2011 7:53 am; edited 1 time in total
Back to top
View user's profile Send private message
cherubiel
PostPosted: Fri Mar 11, 2011 7:23 am    Post subject: Reply with quote

Newbie

Joined: 01 Jun 2010
Posts: 9
Location: ZION

This is my readqueue method

Code:
public void readQ() {
      MQQueueManager qMgr = null;
      MQQueue queue = null;
      
      String[] splits1 = queueManager.split("/");
      String hostname = splits1[2].substring(0, splits1[2].indexOf("("));
      String port     = splits1[2].substring(splits1[2].indexOf("(") + 1, splits1[2].indexOf(")"));
      String channel  = splits1[0];
   
      try {
           Hashtable properties = new Hashtable();
            properties.put(MQC.HOST_NAME_PROPERTY, hostname);
            properties.put(MQC.PORT_PROPERTY, Integer.parseInt(port));
            properties.put(MQC.CHANNEL_PROPERTY, channel);
            properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
           
            qMgr = new MQQueueManager(this.queueManager, properties);

            int openOptions = MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_INQUIRE;

            queue = qMgr.accessQueue(this.queueName, openOptions, null, null, null);

            String msgText = "";
         
            MQMessage rcvMessage = new MQMessage();
            queue.get(rcvMessage);
            byte[] b = new byte[rcvMessage.getMessageLength()];
            rcvMessage.readFully(b);
            msgText = new String(b);

            writeFile(this.fileName, msgText);
      } catch (MQException ex) {
         if (ex.reasonCode == 2033) {
            System.out.println("No message on the specified queue: " + this.queueName);            
         } else {
            System.out.println("A WebSphere MQ Error occured : Completion Code "
                        + ex.completionCode
                        + " Reason Code "
                        + ex.reasonCode);            
         }
         
         writeFile(this.fileName, "");
      } catch (IOException ex) {
         System.out.println("An IOException occured while reading to the message buffer: " + ex);
         writeFile(this.fileName, "");
      } catch (Exception ex) {
         System.out.println("Some other exception!: " + ex);
         writeFile(this.fileName, "");
      } finally {
         try {
            queue.close();
            qMgr.disconnect();
         } catch (Exception e) {
            System.out.println("Error in finally!");
         }
      }      
   }


I supply the queuemanager name to the program in the following format

Quote:
CHANNELNAME/PORTTYPE/HOSTNAME(PORT)


zpat, yes sorry for that. What I really meant was connecting to a remote Queue Manager and performing operations on queues residing there.

mqjeff, well RFHUtil connects well in Client mode. So I knew it had to do something with my initial connection setup.
_________________
Signed with a picture of grapes on the branch
~VRT
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Mar 11, 2011 7:29 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Try putting the new MQQueueManager into a separate try/catch from the accessQueue.

Then think, and review the documentation on MQRC 2058.
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Mar 11, 2011 7:58 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Where do you set the queue manager name value?

Not just the connection data.
Back to top
View user's profile Send private message
cherubiel
PostPosted: Fri Mar 11, 2011 8:23 am    Post subject: Reply with quote

Newbie

Joined: 01 Jun 2010
Posts: 9
Location: ZION

zpat, its supplied to the program as a command-line param.
_________________
Signed with a picture of grapes on the branch
~VRT
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 Java / JMS » RFHUtil default queue open parameters
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.