Author |
Message
|
_Angus_ |
Posted: Thu Apr 23, 2009 1:06 am Post subject: Simple channel inquiry |
|
|
 Acolyte
Joined: 25 Apr 2005 Posts: 54 Location: Edinburgh
|
Hi there,
I'm trying to inquire all channels on a Queue Manager for channel name and connection details. I want this for all channels regardless of status so want to see inactive ones as well. So far I've struggled to work out the PCF code to do this. What I currently have is:
// Build the request
PCFMessage request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL);
// Add a parameter designating all channels should searched
request.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, "*");
// Add a parameter designating the instance type (saved) desired
request.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_TYPE, CMQC.MQOT_SAVED_CHANNEL);
// Add a parameter designating the attributes desired, but first
// build an array list of attributes desired
int[] attrs = {CMQCFC.MQCACH_CHANNEL_NAME,
CMQCFC.MQCACH_CONNECTION_NAME};
// ...now add the parameter for these attributes
request.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS, attrs);
// Now parse the responses ...
PCFMessage responses[] = agent.send (request);
Which always gives my back a parameter error (3014).
Any help explaining where I've gone wrong or, ideally, giving me a code example that works would be much appreciated
Thanks  _________________ *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Angus Cooke ~ AngusSoft
Integration Development Tools
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 23, 2009 2:54 am Post subject: Re: Simple channel inquiry |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
_Angus_ wrote: |
CMQCFC.MQIACH_CHANNEL_INSTANCE_TYPE |
does not belong with
_Angus_ wrote: |
CMQCFC.MQCMD_INQUIRE_CHANNEL |
|
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 23, 2009 2:56 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
In general, you probably want to loop over the results of [code]PCFMessage request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL);
// Add a parameter designating all channels should searched
request.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, "*"); [code]
and then INQUIRE CHANNEL STATUS. |
|
Back to top |
|
 |
_Angus_ |
Posted: Thu Apr 23, 2009 3:25 am Post subject: |
|
|
 Acolyte
Joined: 25 Apr 2005 Posts: 54 Location: Edinburgh
|
Thank-you, that's half solved my problem. As inquire channel will always bring back the channel name that's one piece of information I want. I know I can optionally ask it to give the the channel connection details too - how do I tell it to do that as obviously I can't use the channel instance attributes? _________________ *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Angus Cooke ~ AngusSoft
Integration Development Tools
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 23, 2009 3:34 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Uhm,well
Quote: |
int[] attrs = {CMQCFC.MQCACH_CHANNEL_NAME,
CMQCFC.MQCACH_CONNECTION_NAME}; |
should still work, AFAIK. |
|
Back to top |
|
 |
mqtablet |
Posted: Sat Dec 05, 2009 10:19 am Post subject: |
|
|
Acolyte
Joined: 09 Jun 2009 Posts: 71
|
Even I tried to do the same and I'm getting 3014 as well.
Not sure how to resolve this. I'm working continuously for more than 15 days on this, but could not catch up the result.
I'm fed up and I'm about to give up. Is there any other way to find out the connection name of a channel. I need this very badly.
Here is my code in C#.
MQQueueManager myQMGR = new MQQueueManager(myMQQmgr, myMQSvrConnChl, myMQConName);
PCFMessageAgent agent = new PCFMessageAgent(myQMGR);
PCFMessage request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL);
request.AddParameter(CMQCFC.MQCACH_CHANNEL_NAME, "*");
request.AddParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS, CMQCFC.MQCACH_CONNECTION_NAME);
PCFMessage[] responses = agent.Send(request);
Any help with the code is greatly appreciated.
Thanks in advance,
mqtablet |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Dec 06, 2009 5:00 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mqtablet wrote: |
Even I tried to do the same and I'm getting 3014 as well.
Not sure how to resolve this. I'm working continuously for more than 15 days on this, but could not catch up the result.
I'm fed up and I'm about to give up. Is there any other way to find out the connection name of a channel. I need this very badly.
Here is my code in C#.
MQQueueManager myQMGR = new MQQueueManager(myMQQmgr, myMQSvrConnChl, myMQConName);
PCFMessageAgent agent = new PCFMessageAgent(myQMGR);
PCFMessage request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL);
request.AddParameter(CMQCFC.MQCACH_CHANNEL_NAME, "*");
request.AddParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS, CMQCFC.MQCACH_CONNECTION_NAME);
PCFMessage[] responses = agent.Send(request);
Any help with the code is greatly appreciated.
Thanks in advance,
mqtablet |
Try using channel attributes instead of channel instance attributes.
I believe channel instance attributes are good only for channel status.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqtablet |
Posted: Mon Dec 07, 2009 2:17 am Post subject: |
|
|
Acolyte
Joined: 09 Jun 2009 Posts: 71
|
Hi fjb_saper,
I tried, same error - 3014..  |
|
Back to top |
|
 |
samucich |
Posted: Mon Jan 11, 2010 12:46 pm Post subject: PCF_ChannelStatus.java |
|
|
Newbie
Joined: 11 Jan 2010 Posts: 5
|
Hello MQ fans...
I'm having a similar issue. I'm trying to run the out-of-box sample PCF_ChannelStatus.java program...error looks like this:
C:\Program Files\IBM\WebSphere MQ\tools\pcf\samples>java PCF_ChannelStatus QM_Services3
MQJE001: Completion Code '2', Reason '3065'.
Either the queue manager "QM_Services3" does not exist or the channel "PCFCHANL" does not exist on the queue manager.
Now I know that QM_Services3 is a valid QM...becuase I can run other samples fine using this name. So it must be the channel. I created a new channel called 'PCFCHANL' to match the constant that is in PCF_CommonMethods class. But still i get the error.
Does the channel need to be started? In WMQ Explorer I right-clicked the channel and selected Start...and a msg comes back 'The request to start the channel was accepted' ... but the 'Overall channel status' column always reads Inactive.?
Thanks, bye... |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 11, 2010 6:44 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
PCFCHANL: should probably be of type SVRCONN?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
samucich |
Posted: Tue Jan 12, 2010 4:41 am Post subject: |
|
|
Newbie
Joined: 11 Jan 2010 Posts: 5
|
Yes it is of that type...i've since found another OOB sample that runs ok...i'll use this as a starting point....see below:
C:\Program Files\IBM\WebSphere MQ\tools\pcf\samples>java PCF_DisplayActiveLocalChannels QM_Services3
+-----+------------------------------------------------+----------+
|Index| Channel Name | Type |
+-----+------------------------------------------------+----------+
|0 |PCFCHANL |SVRCN |
|1 |SYSTEM.ADMIN.SVRCONN |SVRCN |
|2 |SYSTEM.AUTO.RECEIVER |RCVR |
|3 |SYSTEM.AUTO.SVRCONN |SVRCN |
|4 |SYSTEM.DEF.CLUSRCVR |CLUSRCVR |
|5 |SYSTEM.DEF.CLUSSDR |CLUSSDR |
|6 |SYSTEM.DEF.RECEIVER |RCVR |
|7 |SYSTEM.DEF.REQUESTER |RQSTR |
|8 |SYSTEM.DEF.SENDER |SDR |
|9 |SYSTEM.DEF.SERVER |SVR |
|10 |SYSTEM.DEF.SVRCONN |SVRCN |
|11 |S_Services3 |SVRCN |
|12 |TO_QM_Services3 |CLUSRCVR |
|13 |WEBLAYERS.CHANNEL |SVRCN |
+-----+------------------------------------------------+----------+ |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 12, 2010 5:22 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
MQRC 3065 is what again?
What does that suggest?
What happens if you use mqsc and issue "DIS CHSTATUS" on the same object? |
|
Back to top |
|
 |
samucich |
Posted: Tue Jan 19, 2010 9:09 am Post subject: |
|
|
Newbie
Joined: 11 Jan 2010 Posts: 5
|
This seems to work...
public static void GetChannelAttrs(PCF_CommonMethods pcfCM) throws PCFException,
MQDataException, IOException {
PCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_INQUIRE_CHANNEL);
//pcfCmd.addParameter(MQConstants.MQCACH_CHANNEL_NAME, "WEBLAYERS.CHANNEL");
pcfCmd.addParameter(MQConstants.MQCACH_CHANNEL_NAME, "*");
int[] attrs = {MQConstants.MQCACH_DESC,MQConstants.MQCACH_MCA_USER_ID};
pcfCmd.addParameter(MQConstants.MQIACH_CHANNEL_TYPE, MQConstants.MQCHT_ALL);
pcfCmd.addParameter(MQConstants.MQIACF_CHANNEL_ATTRS, attrs);
// Execute the command. The returned object is an array of PCF messages.
PCFMessage[] pcfResponse = pcfCM.agent.send(pcfCmd);
// For each returned message, extract the message from the array and display the
// required information.
// The Channel information is held in some array element of the response object (the
// contents of the response object is defined in the documentation).
System.out.println("pcfRespnse is :" + pcfResponse.length);
for (int responseNumber = 0; responseNumber < pcfResponse.length; responseNumber++) {
//System.out.println("In response loop, responseNumber is : " + responseNumber);
//System.out.println("pcdResponse : " + pcfResponse[responseNumber]);
String mca_name = (String)pcfResponse[responseNumber]
.getParameterValue(MQConstants.MQCACH_MCA_USER_ID);
String channel_name = (String)pcfResponse[responseNumber]
.getParameterValue(MQConstants.MQCACH_CHANNEL_NAME);
if(mca_name != null) {
String trimmed_mca_name = mca_name.trim();
if (trimmed_mca_name.length() != 0) {
System.out.println(responseNumber + " MCA User ID is : " + trimmed_mca_name + " for channel " + channel_name + "\n");
}else{
System.out.println(responseNumber + " mca_names is null for channel " + channel_name + "/n");
}
}
}//end of for
} |
|
Back to top |
|
 |
|