|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mq.pcf.PCFAgent
General-purpose agent for sending PCF queries to a queue manager. A PCFAgent maintains a single queue manager connection and provides a simple method for sending PCF requests and returning the set of response messages. The following example uses a PCFAgent to obtain the list of local queues on the queue manager.
PCFAgent agent = new PCFAgent ("localhost", 1414, "CLIENT"); MQMessage [] responses; PCFParameter [] parameters = { new MQCFST (CMQC.MQCA_Q_NAME, "*"), new MQCFIN (CMQC.MQIA_Q_TYPE, MQC.MQQT_LOCAL) }; MQCFH cfh; MQCFSL cfsl; responses = agent.send (CMQCFC.MQCMD_INQUIRE_Q_NAMES, parameters); cfh = new MQCFH (responses [0]); if (cfh.reason == 0) { cfsl = new MQCFSL (responses [0]); for (int i = 0; i < cfsl.strings.length; i++) { System.out.println ("Queue: " + cfsl.strings [i]); } } else { throw new MQException (cfh.compCode, cfh.reason, agent); }
New in version 2.0:
Note: The PCFMessageAgent class (a subclass of PCFAgent) introduced with version 2.0 of this support pack provides a higher-level mechanism for sending PCF messages that is simpler to use. It uses the PCFMessage class (also new in version 2.0) to encapsulate PCF requests and responses, which avoids the need for the application to directly manipulate MQSeries messages and PCF header and parameters structures.
New in version 2.2:
PCFMessageAgent
Field Summary | |
protected com.ibm.mq.MQQueue |
adminQueue
|
static java.lang.String |
copyright
|
protected int |
expiryTime
|
protected com.ibm.mq.MQQueueManager |
qmanager
|
protected int |
qmanager_level
|
protected java.lang.String |
qmanager_name
|
protected com.ibm.mq.MQQueue |
replyQueue
|
java.lang.String |
replyQueueName
|
protected int |
waitInterval
|
Constructor Summary | |
PCFAgent()
Default constructor. |
|
PCFAgent(com.ibm.mq.MQQueueManager qmanager)
Initializes a new PCFAgent with an existing queue manager connection. |
|
PCFAgent(java.lang.String qmanager)
Initializes a new PCFAgent with a bindings connection to a queue manager. |
|
PCFAgent(java.lang.String host,
int port,
java.lang.String channel)
Initializes a new PCFAgent with a client connection to a queue manager. |
Method Summary | |
void |
connect(com.ibm.mq.MQQueueManager qmanager)
Adopts a connection to a queue manager. |
void |
connect(java.lang.String qmanager)
Establishes a bindings connection to a queue manager. |
void |
connect(java.lang.String host,
int port,
java.lang.String channel)
Establishes a client connection to a queue manager. |
void |
disconnect()
Frees queue manager resources, and drops the current queue manager connection. |
java.lang.String |
getQManagerName()
Returns the name of the queue manager (if connected). |
protected void |
open(com.ibm.mq.MQQueueManager qmanager,
boolean external)
|
com.ibm.mq.MQMessage[] |
send(int command,
PCFParameter[] parameters)
Sends a PCF query to the connected queue manager and returns the response. |
void |
setWaitInterval(int seconds)
Set the wait interval for PCF responses. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String copyright
public final java.lang.String replyQueueName
protected int expiryTime
protected int waitInterval
protected com.ibm.mq.MQQueueManager qmanager
protected int qmanager_level
protected java.lang.String qmanager_name
protected com.ibm.mq.MQQueue adminQueue
protected com.ibm.mq.MQQueue replyQueue
Constructor Detail |
public PCFAgent()
public PCFAgent(com.ibm.mq.MQQueueManager qmanager) throws com.ibm.mq.MQException
qmanager
- an existing queue manager connectioncom.ibm.mq.MQException
- if the queue manager cannot be accessedpublic PCFAgent(java.lang.String host, int port, java.lang.String channel) throws com.ibm.mq.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 connectioncom.ibm.mq.MQException
- if the connection cannot be establishedpublic PCFAgent(java.lang.String qmanager) throws com.ibm.mq.MQException
qmanager
- the name of the queue managercom.ibm.mq.MQException
- if the connection cannot be establishedMethod Detail |
public void connect(com.ibm.mq.MQQueueManager qmanager) throws com.ibm.mq.MQException
qmanager
- an existing queue manager connectioncom.ibm.mq.MQException
- if the queue manager cannot be accessedpublic void connect(java.lang.String host, int port, java.lang.String channel) throws com.ibm.mq.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 connectioncom.ibm.mq.MQException
- if the connection cannot be establishedpublic void connect(java.lang.String qmanager) throws com.ibm.mq.MQException
qmanager
- the queue manager namecom.ibm.mq.MQException
- if the connection cannot be establishedprotected void open(com.ibm.mq.MQQueueManager qmanager, boolean external) throws com.ibm.mq.MQException
public void disconnect() throws com.ibm.mq.MQException
com.ibm.mq.MQException
- if there is a problem disconnectingpublic com.ibm.mq.MQMessage[] send(int command, PCFParameter[] parameters) throws com.ibm.mq.MQException, java.io.IOException
command
- the PCF command identifierparameters
- an array of integer or string parameter or parameter array structures
(type MQCFIN, MQCFIL, MQCFST or MQCFSL).com.ibm.mq.MQException
- if there is a problem with the request or responsejava.io.IOException
- if there is a problem with reading or writingpublic void setWaitInterval(int seconds)
seconds
- the wait interval in secondspublic java.lang.String getQManagerName()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |