public class PCFAgent
extends com.ibm.mq.jmqi.JmqiObject
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);
}
PCFMessageAgent| Modifier and Type | Field and Description |
|---|---|
static int |
MAXIMUM_ALLOWED_PREFIX_LENGTH |
java.lang.String |
replyQueueName
Deprecated.
Use getReplyQueueName instead.
|
| Constructor and Description |
|---|
PCFAgent()
Default constructor.
|
PCFAgent(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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect(MQQueueManager qmanagerP)
Adopts a connection to a queue manager.
|
void |
connect(MQQueueManager qmanagerP,
java.lang.String targetQueue,
java.lang.String targetQmanager)
Adopts a connection to a queue manager and specifies a target queue and queue manager.
|
void |
connect(java.lang.String qmanagerP)
Establishes a bindings connection to a queue manager.
|
void |
connect(java.lang.String hostP,
int port,
java.lang.String channelP)
Establishes a client connection to a queue manager.
|
void |
connect(java.lang.String hostP,
int port,
java.lang.String channelP,
java.lang.String targetQueue,
java.lang.String targetQmanager)
Establishes a client connection to a queue manager and specifies a target queue and queue
manager.
|
void |
connect(java.lang.String qmanagerP,
java.lang.String targetQueue,
java.lang.String targetQmanager)
Establishes a bindings connection to a queue manager and specifies a target queue and queue
manager.
|
void |
disconnect()
Frees queue manager resources, and drops the current queue manager connection.
|
int |
getCommandLevel()
Returns the command level.
|
int |
getExpiry()
Returns the expiry time in seconds.
|
java.lang.String |
getModelQueueName() |
int |
getPlatform()
Returns the platform level.
|
java.lang.String |
getQManagerName()
Returns the name of the queue manager (if connected).
|
java.lang.String |
getReplyQueueName()
Returns the name of the reply queue for PCF responses (if connected).
|
java.lang.String |
getReplyQueuePrefix() |
int |
getWaitInterval()
Returns the wait interval in seconds.
|
MQMessage[] |
send(int command,
PCFParameter[] parameters)
Sends a PCF query to the connected queue manager and returns the response.
|
void |
setCharacterSet(int ccsid)
Sets the CCSID used in the message descriptor of request and response messages.
|
void |
setEncoding(int encoding)
Sets the encoding used in the message descriptor of request and response messages.
|
void |
setModelQueueName(java.lang.String name)
Sets the name of the model queue used by the agent to create its reply queue, which is a
temporary dynamic queue.
|
void |
setReplyQueuePrefix(java.lang.String prefixP)
Sets the string used as the first part of the agent's reply queue name.
|
void |
setWaitInterval(int seconds)
Set the wait interval and expiry for PCF responses.
|
void |
setWaitInterval(int wait,
int expiry)
Set the wait interval and expiry for PCF responses.
|
public static final int MAXIMUM_ALLOWED_PREFIX_LENGTH
public java.lang.String replyQueueName
getReplyQueueName()public PCFAgent()
public PCFAgent(MQQueueManager qmanager) throws MQException
qmanager - an existing queue manager connectionMQException - if the queue manager cannot be accessedpublic PCFAgent(java.lang.String host,
int port,
java.lang.String channel)
throws MQException
host - the hostname or IP address where the queue manager resides - default (if null or empty string) "localhost"port - the port on which the queue manager listens for incoming channel connectionschannel - the client channel to use for the connection - default (if null or empty string) "SYSTEM.DEF.SVRCONN"MQException - if the connection cannot be establishedpublic PCFAgent(java.lang.String qmanager)
throws MQException
qmanager - the name of the queue managerMQException - if the connection cannot be establishedpublic void connect(MQQueueManager qmanagerP) throws MQException
qmanagerP - an existing queue manager connectionMQException - if the queue manager cannot be accessedpublic void connect(MQQueueManager qmanagerP, java.lang.String targetQueue, java.lang.String targetQmanager) throws MQException
qmanagerP - an existing queue manager connectiontargetQueue - the target queue nametargetQmanager - the target queue manager nameMQException - if the queue manager cannot be accessedpublic void connect(java.lang.String hostP,
int port,
java.lang.String channelP)
throws MQException
hostP - the hostname or IP address where the queue manager resides - default (if null or empty string) "localhost"port - the port on which the queue manager listens for incoming channel connectionschannelP - the client channel to use for the connection - default (if null or empty string) "SYSTEM.DEF.SVRCONN"MQException - if the connection cannot be establishedpublic void connect(java.lang.String hostP,
int port,
java.lang.String channelP,
java.lang.String targetQueue,
java.lang.String targetQmanager)
throws MQException
hostP - the hostname or IP address where the queue manager resides - default (if null or empty string) "localhost"port - the port on which the queue manager listens for incoming channel connectionschannelP - the client channel to use for the connection - default (if null or empty string) "SYSTEM.DEF.SVRCONN"targetQueue - the target queue nametargetQmanager - the target queue manager nameMQException - if the connection cannot be establishedpublic void connect(java.lang.String qmanagerP)
throws MQException
qmanagerP - the queue manager nameMQException - if the connection cannot be establishedpublic void connect(java.lang.String qmanagerP,
java.lang.String targetQueue,
java.lang.String targetQmanager)
throws MQException
qmanagerP - the queue manager nametargetQueue - the target queue nametargetQmanager - the target queue manager nameMQException - if the connection cannot be establishedpublic void disconnect()
throws MQException
MQException - if there is a problem disconnectingpublic MQMessage[] send(int command, PCFParameter[] parameters) throws 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).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 and expiry time in secondssetWaitInterval(int, int)public void setWaitInterval(int wait,
int expiry)
wait - the wait interval in secondsexpiry - the expiry time in secondspublic int getWaitInterval()
public int getExpiry()
public java.lang.String getQManagerName()
public java.lang.String getReplyQueueName()
public void setEncoding(int encoding)
encoding - the numeric encodingpublic void setCharacterSet(int ccsid)
ccsid - the character set identifierpublic int getPlatform()
public int getCommandLevel()
public java.lang.String getReplyQueuePrefix()
setReplyQueuePrefix(String)public void setReplyQueuePrefix(java.lang.String prefixP)
prefixP - The prefix value to be setpublic java.lang.String getModelQueueName()
public void setModelQueueName(java.lang.String name)
name - getReplyQueueName()