public class PCFMessageAgent extends PCFAgent
PCFMessage class for requests and replies, which avoids exposure to the details of
underlying PCF header structures. The PCFMessageAgent also provides the capability to check the
header contents of a PCF response and throw a PCFException if the response indicates an error.
The following example uses a PCFMessageAgent to obtain the list of local queues on the queue
manager.
import com.ibm.mq.pcf.*;
...
try
{
PCFMessageAgent agent = new PCFMessageAgent ("localhost", 1414, "CLIENT");
PCFMessage request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q_NAMES);
request.addParameter (CMQC.MQCA_Q_NAME, "*");
request.addParameter (CMQC.MQIA_Q_TYPE, MQC.MQQT_LOCAL);
PCFMessage [] responses = agent.send (request);
String [] names = (String []) responses [0].getParameterValue (CMQCFC.MQCACF_Q_NAMES);
for (int i = 0; i < names.length; i++)
{
System.out.println ("Queue: " + names [i]);
}
}
catch (PCFException pcfe)
{
System.err.println ("PCF error: " + pcfe);
}
catch (MQException mqe)
{
System.err.println (mqe);
}
catch (IOException ioe)
{
System.err.println (ioe);
}
MAXIMUM_ALLOWED_PREFIX_LENGTH, replyQueueName| Constructor and Description |
|---|
PCFMessageAgent()
Default constructor.
|
PCFMessageAgent(MQQueueManager qmanager)
Initializes a new PCFMessageAgent with an existing queue manager connection.
|
PCFMessageAgent(java.lang.String qmanager)
Initializes a new PCFMessageAgent with a bindings connection to a queue manager.
|
PCFMessageAgent(java.lang.String host,
int port,
java.lang.String channel)
Initializes a new PCFMessageAgent with a client connection to a queue manager.
|
| Modifier and Type | Method and Description |
|---|---|
PCFMessage[] |
send(PCFMessage request)
Sends a PCF request to the connected queue manager and returns the responses.
|
PCFMessage[] |
send(PCFMessage request,
boolean check)
Deprecated.
Use setCheckResponses and send(com.ibm.mq.pcf.PCFMessage)
|
PCFMessage[] |
send(PCFMessage request,
boolean check,
boolean usePlatformSettings)
Deprecated.
Use setCheckResponses/setUsePlatformSettings and
send(com.ibm.mq.pcf.PCFMessage)
|
void |
setCheckResponses(boolean option)
If this option is set, the send method throws a PCFException if the responses include a PCF
message with the reason code MQRCCF_COMMAND_FAILED in the MQCFH header.
|
void |
setUsePlatformSettings(boolean option)
If this option is set, the send method alters the MQCFH contained within the PCFMessage request
if necessary to match the platform of the connected queue manager.
|
connect, connect, connect, connect, connect, connect, disconnect, getCommandLevel, getExpiry, getModelQueueName, getPlatform, getQManagerName, getReplyQueueName, getReplyQueuePrefix, getWaitInterval, send, setCharacterSet, setEncoding, setModelQueueName, setReplyQueuePrefix, setWaitInterval, setWaitIntervalpublic PCFMessageAgent()
public PCFMessageAgent(MQQueueManager qmanager) throws MQException
qmanager - an existing queue manager connectionMQException - if the queue manager cannot be accessedpublic PCFMessageAgent(java.lang.String host,
int port,
java.lang.String channel)
throws MQException
host - the hostname or IP address where the queue manager residesport - the port on which the queue manager listens for incoming channel connectionschannel - the client channel to use for the connectionMQException - if the connection cannot be establishedpublic PCFMessageAgent(java.lang.String qmanager)
throws MQException
qmanager - the name of the queue managerMQException - if the connection cannot be establishedpublic PCFMessage[] send(PCFMessage request) throws PCFException, MQException, java.io.IOException
request - the PCF request messagePCFException - if the response indicates an error in PCF processingMQException - if there is a problem with the request or responsejava.io.IOException - if there is a problem with reading or writingsetCheckResponses(boolean),
setUsePlatformSettings(boolean)public PCFMessage[] send(PCFMessage request, boolean check) throws PCFException, MQException, java.io.IOException
request - the PCF request messagecheck - if set, the agent will check the reason code in the MQCFH of the responses and
generate a PCFException if MQRCCF_COMMAND_FAILED appearsPCFException - if the responses include MQRCCF_COMMAND_FAILEDMQException - if there is a problem with the request or responsejava.io.IOException - if there is a problem with reading or writingsetCheckResponses(boolean),
setUsePlatformSettings(boolean)public PCFMessage[] send(PCFMessage request, boolean check, boolean usePlatformSettings) throws PCFException, MQException, java.io.IOException
request - the PCF request messagecheck - if set, the agent will check the reason code in the MQCFH of the responses and
generate a PCFException if MQRCCF_COMMAND_FAILED appearsusePlatformSettings - PCFException - if the responses include MQRCCF_COMMAND_FAILEDMQException - if there is a problem with the request or responsejava.io.IOException - if there is a problem with reading or writingsetCheckResponses(boolean),
setUsePlatformSettings(boolean)public void setCheckResponses(boolean option)
option - public void setUsePlatformSettings(boolean option)
option -