I'm using mo01 java support pack to read event messages from SYSTEM.ADMIN.CHANNEL.EVENT Queue .
Below is the link to code:
I can able to read all parameter name/value from the PCF Message consumed from channel event queue except the below parameter,
ReasonQualifier Specifies the identifier that qualifies the reason code. Identifier MQIACF_REASON_QUALIFIER. Datatype MQCFIN. Values One of the following: MQRQ_CHANNEL_STOPPED_OK Channel has been closed with either a zero return code or a warning return code. MQRQ_CHANNEL_STOPPED_ERROR Channel has been closed, but there is an error reported and the channel is not in stopped or retry state. MQRQ_CHANNEL_STOPPED_RETRY Channel has been closed and it is in retry state. MQRQ_CHANNEL_STOPPED_DISABLED Channel has been closed and it is in a stopped state. Returned Always.
Below is the part of code,
Map reasonCodes = new HashMap();
/** Map of MQ command names and values. */
Map commands = new HashMap();
/** Map of MQ string names and values. */
Map stringNames = new HashMap();
private String getStringName(int stringInt)
{
return (String)stringNames.get(new Integer(stringInt));
}
/**
* Converts a constant integer to its MQ command name.
* @param stringInt the MQ integer.
* @return the MQ command name represented by the constant integer.
*/
private String getCommandName(int stringInt)
{
return (String)commands.get(new Integer(stringInt));
}
// Below methods retrieves int code's string value from classes and store in HashMap
public void setupMaps()
{
setupReasonNameSub("com.ibm.mq.pcf.CMQC", "MQRC", reasonCodes);
setupReasonNameSub("com.ibm.mq.pcf.CMQCFC", "MQRC", reasonCodes);
setupReasonNameSub("com.ibm.mq.pcf.CMQCFC", "MQCMD", commands);
setupReasonNameSub("com.ibm.mq.pcf.CMQC", "MQCA", stringNames);
setupReasonNameSub("com.ibm.mq.pcf.CMQCFC", "MQCA", stringNames);
setupReasonNameSub("com.ibm.mq.pcf.CMQC", "MQIA", stringNames);
setupReasonNameSub("com.ibm.mq.pcf.CMQC", "MQRQ", reasonCodes);
}
void readPCFMessage(PCFMessage pcfMessage){
Enumeration pcfEnum = pcfMessage.getParameters();
stdout =
stdout + "" + getReasonName(pcfMessage.getReason()) + "\n";
while (pcfEnum.hasMoreElements())
{
String parameterName;
PCFParameter elt = (PCFParameter)pcfEnum.nextElement();
parameterName = getStringName(elt.getParameter());
stdout = stdout + "";
if (elt.getType() == CMQCFC.MQCFT_STRING_LIST)
{
String strings[] = (String[])elt.getValue();
for (int i = 0; i " + strings[i] + "\n";
}
}
else
stdout = stdout + elt.getValue().toString();
stdout = stdout + "\n";
}
System.out.println(stdout);
}
Output:
MQRC_CHANNEL_STOPPED
QMGR1
CHL.TO.CHLA
SYSTEM.CLUSTER.TRANSMIT.QUEUE
172.21.33.123
9
0
0
0
CHL.TO.CHLA
If a channel is stopped , I want to know the exact reason on whether it is stopped with a issue or a normal OK. This parameter tells us the right reason on channel stopped.
Any idea why this parameter is not retrievable?