Author |
Message
|
Suessli |
Posted: Wed Mar 11, 2009 5:55 am Post subject: Inquire parameters from QM_1 via QM_2 with PCF Java API? |
|
|
Novice
Joined: 29 Jan 2008 Posts: 15
|
Hi everyone,
is this possible. Anyone examples for me?
How do I tell the PCFAgent that he should connect to QM_2 but get information from QM_1? _________________ Suessli |
|
Back to top |
|
 |
Vitor |
Posted: Wed Mar 11, 2009 5:58 am Post subject: Re: Inquire parameters from QM_1 via QM_2 with PCF Java API? |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Suessli wrote: |
How do I tell the PCFAgent that he should connect to QM_2 but get information from QM_1? |
Use QM_2 to redirect the PCF message to QM_1. Standard request/reply/remote queue stuff. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Suessli |
Posted: Wed Mar 11, 2009 6:11 am Post subject: Re: Inquire parameters from QM_1 via QM_2 with PCF Java API? |
|
|
Novice
Joined: 29 Jan 2008 Posts: 15
|
Vitor wrote: |
Use QM_2 to redirect the PCF message to QM_1. Standard request/reply/remote queue stuff. |
So you want to tell me that this is not possibla with the Admin API and I have to use MQ API instead? That is just great ... _________________ Suessli |
|
Back to top |
|
 |
Vitor |
Posted: Wed Mar 11, 2009 6:14 am Post subject: Re: Inquire parameters from QM_1 via QM_2 with PCF Java API? |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Suessli wrote: |
So you want to tell me that this is not possibla with the Admin API and I have to use MQ API instead? That is just great ... |
I want to tell you nothing of the kind!
Unless there's something weird about the PCFAgent I'm unaware of that locks it to a specific location. Possible, given my level of Java knowledge.
But in concept it should be straightforward enough. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Suessli |
Posted: Wed Mar 11, 2009 6:22 am Post subject: Re: Inquire parameters from QM_1 via QM_2 with PCF Java API? |
|
|
Novice
Joined: 29 Jan 2008 Posts: 15
|
Vitor wrote: |
I want to tell you nothing of the kind!
Unless there's something weird about the PCFAgent I'm unaware of that locks it to a specific location. Possible, given my level of Java knowledge.
But in concept it should be straightforward enough. |
I think I understand the concept but I have no idea how to tell the PCFAgent to forward my request to QM_1. I am creating new PCF Agent via
Code: |
new PCFAgent(host, port, channel);
|
so it connects directly to the queue manager runing under host X and with port Y. Now I found nothing about a method or constant which allows me to forward my request. However MO71 has the option to do this. So I think it is possible. But ... how?!  _________________ Suessli |
|
Back to top |
|
 |
Vitor |
Posted: Wed Mar 11, 2009 6:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Ah - so it is some weird Java thing I'm unaware of!
Clearly the PCFAgent is directly attaching to the queue manager in question rather than simply generating a PCF message. So you're right, it's not possible with PCFAgent.
Time to RYO PCF messages methinks.....  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Mar 11, 2009 6:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You don't tell the Agent to connect to the remote queue manager. You construct PCFMessages that are destined for the remote queue manager. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Mar 11, 2009 6:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
You don't tell the Agent to connect to the remote queue manager. You construct PCFMessages that are destined for the remote queue manager. |
Now I thought that, until all these connection details started getting bandied about.....  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Suessli |
Posted: Wed Mar 11, 2009 6:37 am Post subject: |
|
|
Novice
Joined: 29 Jan 2008 Posts: 15
|
mqjeff wrote: |
You don't tell the Agent to connect to the remote queue manager. You construct PCFMessages that are destined for the remote queue manager. |
Jeff I am constructing a PCFMessage as follows.
Code: |
PCFMessage request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q);
request.addParameter (CMQC.MQCA_Q_NAME, "*");
|
How do I construct this message for a remote queue manager? Can you provide code examples?
I was trying the following
Code: |
request.addParameter(CMQC.MQCA_Q_MGR_NAME, qMgr);
|
but then I am getting MQRC 3016 which is MQRCCF_MSG_LENGTH_ERROR. _________________ Suessli |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Mar 11, 2009 6:41 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'd suggest you use a different constructor from the PCFMessage class. |
|
Back to top |
|
 |
Suessli |
Posted: Wed Mar 11, 2009 6:47 am Post subject: |
|
|
Novice
Joined: 29 Jan 2008 Posts: 15
|
mqjeff wrote: |
I'd suggest you use a different constructor from the PCFMessage class. |
Can you please be more specific. Which constructor do you mean? _________________ Suessli |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Mar 11, 2009 7:57 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Search for one that allows you to set the destination qmgr and queue on the MQMD. Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Suessli |
Posted: Thu Mar 12, 2009 2:06 am Post subject: |
|
|
Novice
Joined: 29 Jan 2008 Posts: 15
|
I was trying it as follows.
Code: |
MQEnvironment.hostname = "XXX";
MQEnvironment.port = 1414;
MQEnvironment.channel = "XXX";
MQEnvironment.userID = "xxx";
try {
// connecting
MQQueueManager qmgr = new MQQueueManager("XXX");
// connected
// open pcf request and reply queue
String replyQueueName = "PCF.REPLY";
MQQueue adminQueue = qmgr.accessQueue(
qmgr.getCommandInputQueueName(),
MQC.MQOO_INPUT_EXCLUSIVE, "", "", "mqm");
MQQueue replyQueue = qmgr.accessQueue (
"SYSTEM.DEFAULT.MODEL.QUEUE",
MQC.MQOO_INPUT_EXCLUSIVE, "", replyQueueName, "mqm");
// generate request
MQMessage message = new MQMessage();
message.messageType = MQC.MQMT_REQUEST;
message.expiry = 100;
message.feedback = MQC.MQFB_NONE;
message.format = MQC.MQFMT_ADMIN;
message.replyToQueueManagerName = "XXX";
message.replyToQueueName = replyQueueName;
PCFMessage request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q);
request.addParameter (CMQC.MQCA_Q_NAME, "*");
request.addParameter (CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL);
request.addParameter (CMQCFC.MQIACF_Q_ATTRS,
new int [] { CMQC.MQCA_Q_NAME, CMQC.MQIA_CURRENT_Q_DEPTH });
request.write(message);
MQPutMessageOptions pmo = new MQPutMessageOptions ();
// sending request
adminQueue.put(message, pmo);
// send
} catch (MQException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
|
But there is simply no option where I can set the destination queue manager YYY MQMessage does not provide s.th. like destination queue manager. Nobody was trying this? _________________ Suessli |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Mar 12, 2009 3:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Sorry,I was not thinking it through clearly.
You need to use a different connect method. |
|
Back to top |
|
 |
Suessli |
Posted: Thu Mar 12, 2009 4:45 am Post subject: |
|
|
Novice
Joined: 29 Jan 2008 Posts: 15
|
mqjeff wrote: |
...
You need to use a different connect method. |
Thanks for this hint Jeff. Using this method
Code: |
connect(com.ibm.mq.MQQueueManager qmanager, java.lang.String targetQueue, java.lang.String targetQmanager)
|
helped  _________________ Suessli |
|
Back to top |
|
 |
|