|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
RFHUtil default queue open parameters |
« View previous topic :: View next topic » |
Author |
Message
|
cherubiel |
Posted: Fri Mar 11, 2011 6:44 am Post subject: RFHUtil default queue open parameters |
|
|
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 |
|
 |
mqjeff |
Posted: Fri Mar 11, 2011 7:00 am Post subject: |
|
|
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 |
|
 |
zpat |
Posted: Fri Mar 11, 2011 7:16 am Post subject: |
|
|
 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 |
|
 |
cherubiel |
Posted: Fri Mar 11, 2011 7:23 am Post subject: |
|
|
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 |
|
 |
mqjeff |
Posted: Fri Mar 11, 2011 7:29 am Post subject: |
|
|
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 |
|
 |
zpat |
Posted: Fri Mar 11, 2011 7:58 am Post subject: |
|
|
 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 |
|
 |
cherubiel |
Posted: Fri Mar 11, 2011 8:23 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|