|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mqe.MQe | +--com.ibm.mqe.MQeFields | +--com.ibm.mqe.MQeMsgObject | +--com.ibm.mqe.MQeAdminMsg | +--com.ibm.mqe.administration.MQeConnectionAdminMsg
This class is used to manage Websphere MQ Everyplace connection definitions.
The class extends MQeAdminMsg and provides the
implementation for managing connections.For information on
basic administration concepts see MQeAdminMsg
The following actions are applicable on connections:
MQeAdminMsg.Action_Create
MQeAdminMsg.Action_Delete
MQeAdminMsg.Action_Inquire
MQeAdminMsg.Action_InquireAll
MQeAdminMsg.Action_Update
MQeAdminMsg.Action_AddAlias
MQeAdminMsg.Action_RemoveAlias
A connection defines how one queue manager establishes a connection to another queue manager. Once a connection has been defined, it is possible for a queue manager to manipulate messages on the remote queue manager either synchronously or asynchronsly.
Multiple connections can be defined on a queue manager but each must have a unique name. i.e. only one connection can be defined to a given destination.
A connection definition holds parameters that are used when establishing a logical connection called a channel between two queue managers. The channel is established dynamically as and when communication is required. A channel does not worry about the type of network or protocol, it hands this job to a communications adapter. The connection definition contains details on the type of channel and the type of adapter to use for a connection. Information on the supplied set of adapters can be found in package com.ibm.mqe.adapters
As well as specifying the adapter, data required by the adapater is required. The adapter field defines not just the adapter but the basic parameters required by the adatper. This is called a file descriptor and takes the form:
For instance com.ibm.mqe.adpaters.MQeTcpipHttpAdapter:192.168.0.1:8082 defines an http adapter that communicates with another queue manager on host 192.168.0.1 and port 8082.
Network:192.168.0.1:8081 defines an adapter called "Network" which is an alias for the MQeTcpipHttpAdapter that communicates with another queue manager on host 192.168.0.1 and port 8082.
A connection contains an array of one or more adapters. This version of WebSphere MQ Everyplace only supports the definition of one adapter in the adapter array.
It is important that the adapter and its parameters match that of the
communication listener on the queue manager being connected to. If there
is a mismatch then communications between the two queue managers will fail.
For information on administering communications listeners
see MQeCommunicationsListenerAdminMsg
.
Several types of connection can be defined:
The table below shows how the different types of connection are defined:
Connection type | Name | Adapter Array | Adapter file descriptor | Adapter parameters | Adapter options | Channel |
Direct | mandatory | One adapter | mandatory | optional | optional | mandatory |
Via | mandatory | One adapter | name of next hop | no | no | no |
no op | mandatory | no | null | no | no | null |
Additional information can be passed to the adapter via the adapter parameters and options fields. For instance if the connection is to a queue manager running as a servlet then the adapter parameter can contain the name of the servlet.
Multiple names or aliases can be assigned to a connection. When an application calls methods on a queue manager that require a queue manager name be specified, an alias can also be used. Both a local and remote queue managers can be aliased.
When creating a connection definition it is important a reply is obtained on the success of the request before attempting to use that connection definition. For this reason it is recommended that when creating a connection definition the reply to queue manager is always set to either the local queue manager or a queue manager with an existing connection definition. *
For an example of how to use this class, Example2
Properties of the Connection resource
(in addition to those inherited - see MQeAdminMsg ) |
|
---|---|
Field name | Actions using these fields |
Con_Description
| MQeAdminMsg.Action_Inquire , MQeAdminMsg.Action_Create , MQeAdminMsg.Action_Update .
|
Con_Adapters
| MQeAdminMsg.Action_Inquire , MQeAdminMsg.Action_Create , MQeAdminMsg.Action_Update .
|
Con_Adapter
| MQeAdminMsg.Action_Inquire , MQeAdminMsg.Action_Create , MQeAdminMsg.Action_Update .
|
Con_AdapterAsciiParm
| MQeAdminMsg.Action_Inquire , MQeAdminMsg.Action_Create , MQeAdminMsg.Action_Update .
|
Con_AdapterOptions
| MQeAdminMsg.Action_Inquire , MQeAdminMsg.Action_Create , MQeAdminMsg.Action_Update .
|
Con_Aliases
| MQeAdminMsg.Action_Inquire , MQeAdminMsg.Action_Create , MQeAdminMsg.Action_Update .
|
Field Summary | |
static java.lang.String |
Con_Adapter
String used to identify the field in the message representing an adapter file descriptor. |
static java.lang.String |
Con_AdapterAsciiParm
String used to identify the field in the message representing parameters for an adapter. |
static java.lang.String |
Con_AdapterOptions
String used to identify the field in the message representing options for an adapter. |
static java.lang.String |
Con_Adapters
String used to identify the field in the message representing a set of communications adapters and parameters. |
static java.lang.String |
Con_Aliases
String used to identify the field in the message representing a set of aliases for the connection. |
static java.lang.String |
Con_Channel
String used to identify the field in the message representing the type of channel. |
static java.lang.String |
Con_Description
String used to identify the field in the admin message representing the description of the listener. |
Fields inherited from class com.ibm.mqe.MQeAdminMsg |
Action_AddAlias, Action_Create, Action_Delete, Action_Inquire, Action_InquireAll, Action_RemoveAlias, Action_Start, Action_Stop, Action_Unknown, Action_Update, Admin_Action, Admin_Class, Admin_Errors, Admin_MaxAttempts, Admin_Name, Admin_Parms, Admin_RC, Admin_Reason, Admin_TargetQMgr, RC_Fail, RC_Mixed, RC_Success |
Fields inherited from class com.ibm.mqe.MQeFields |
ArraySeparator, TypeArrayElements, TypeAscii, TypeBoolean, TypeByte, TypeDouble, TypeFields, TypeFloat, TypeInt, TypeLong, TypeShort, TypeUnicode, TypeUnTyped |
Constructor Summary | |
MQeConnectionAdminMsg()
Default constructor. |
|
MQeConnectionAdminMsg(java.lang.String qMgrName)
This constructor takes the name of the connection and puts it into the admin msg. |
Method Summary | |
void |
addAlias(java.lang.String alias)
Setup the admin message to add an alias to the connection. |
void |
changeAlias(java.lang.String alias)
Adds an alias name to the aliases array. |
void |
create(java.lang.String adapter,
java.lang.String parameters,
java.lang.String options,
java.lang.String channel,
java.lang.String desc)
Setup the administration message to create a connection. |
void |
removeAlias(java.lang.String alias)
Setup the admin message to remove an alias from the connection. |
void |
update(java.lang.String adapter,
java.lang.String parameters,
java.lang.String options,
java.lang.String channel,
java.lang.String desc)
Setup the administration message to update a connection. |
Methods inherited from class com.ibm.mqe.MQeAdminMsg |
characteristics, create, delete, duplicate, getAction, getErrorFields, getFieldInError, getInputFields, getMaxAttempts, getName, getOutputFields, getRC, getReason, getTargetQMgr, inquire, inquireAll, setAction, setMaxAttempts, setName, setTargetQMgr, update |
Methods inherited from class com.ibm.mqe.MQeMsgObject |
getMsgUIDFields, getOriginQMgr, getTimeStamp, putOriginQMgr, resetMsgUIDFields, unwrapMsgObject |
Methods inherited from class com.ibm.mqe.MQe |
abbreviate, alias, asciiToByte, byteToAscii, byteToHex, byteToHex, byteToInt, byteToLong, byteToShort, byteToUnicode, fileSeparator, getEventLogHandler, hexToAscii, hexToByte, intToByte, isCLDC, loadClass, loadObject, log, setEventLogHandler, setLoader, sliceByteArray, type, unicodeToByte, uniqueValue |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String Con_Description
The field is of type unicode
public static final java.lang.String Con_Channel
Use either the class name or class alias for the channel that this connection will use. For instance com.ibm.mqe.MQeChannel or DefaultChannel.
The field is manadatory for a direct connection and can be null for other types of connection.
The field is of type ascii
public static final java.lang.String Con_Adapters
The field is an array of MQeFields objects where each entry represents an adapter and its parameters. The current version of the product only supports a maximum of one entry in the array.
Each MQeFields entry in the array can consist of the following fields:
The field is mandatory for direct and via connections.
The field is of type MQeFields Array
public static final java.lang.String Con_Adapter
This field is contained in an MQeFields object that is stored
in field Con_Adapters
.
The file descriptor takes the form:
For example,
The field is mandatory for direct and via connections.
The field is of type ascii
Con_Adapters
,
com.ibm.mqe.adapters,
Constant Field Valuespublic static final java.lang.String Con_AdapterAsciiParm
This field is contained in an MQeFields object that is stored
in field Con_Adapters
.
For example when using an http adapter to communicate with a queue manager running in a servlet, this field can contain the name of the servlet like /servet/MQe.
The field is of type ascii
Con_Adapter
,
Con_Adapters
,
com.ibm.mqe.adapters,
Constant Field Valuespublic static final java.lang.String Con_AdapterOptions
This field is contained in an MQeFields object that is stored
in field Con_Adapters
.
For example when using a tcpip length adapter the following
options can be used:
The field is of type ascii
Con_Adapter
,
Con_Adapters
,
com.ibm.mqe.adapters,
Constant Field Valuespublic static final java.lang.String Con_Aliases
Multiple names or aliases can be assigned to a connection. This field holds the set of aliases.
The field is of type ascii array
Constructor Detail |
public MQeConnectionAdminMsg() throws java.lang.Exception
java.lang.Exception
public MQeConnectionAdminMsg(java.lang.String qMgrName) throws java.lang.Exception
This constructor uses the MQeAdminMsg.setName(String)
method to
put the name into the administratoin message parameters field
java.lang.Exception
MQeAdminMsg.setName(String)
Method Detail |
public void addAlias(java.lang.String alias) throws java.lang.Exception
A method that assists in setting up an administratoin message to add
one or more aliases to a connection definition. Multiple aliases can be
added in one message by calling the method multiple times. The message is
set to perform action MQeAdminMsg.Action_AddAlias
.
The following basic fields are set:
The following fields are set in the Admin_Parms field.
The name of the connection to add an alias to is specified using
method MQeAdminMsg.setName(java.lang.String)
or using
the constructor that takes the resource name or by setting
the MQeAdminMsg.Admin_Name
field.
alias
- the alias to add to the connection.
java.lang.Exception
MQeAdminMsg.Action_AddAlias
,
Con_Aliases
public void changeAlias(java.lang.String alias) throws java.lang.Exception
alias
- java.lang.String
java.lang.Exception
public void create(java.lang.String adapter, java.lang.String parameters, java.lang.String options, java.lang.String channel, java.lang.String desc) throws java.lang.Exception
A method that assists the construction of a connection
administration message in order to create a connection. The message is
set to perform action MQeAdminMsg.Action_Create
.
The following basic fields are set:
The following fields are set in the Admin_Parms field.
The name of the connection to be created is specified using
method MQeAdminMsg.setName(java.lang.String)
or using
the constructor that takes the resource name or by setting
the MQeAdminMsg.Admin_Name
field.
adapter
- File descriptor for the adapter.options
- Adapter optionschannel
- Type of channel to use
java.lang.Exception
MQeAdminMsg.Action_Create
MQeConnectionAdminMsg con = new MQeConnectionAdminMsg(); con.setName("ServerQM123"); con.create("Network:127.0.0.1:8081", null, null, "DefaultChannel", "Con to MQeServer"); MQeConnectionAdminMsg con2 = new MQeConnectionAdminMsg(); con2.setName("ServletQM123"); con2.create("Network:127.0.0.1:8081", "/servlet/MQe", null, "DefaultChannel", "Con to MQeServlet");
public void removeAlias(java.lang.String alias) throws java.lang.Exception
A method that assists in setting up an administratoin message to remove
one or more aliases from a connection. Multiple aliases can be removed in
one message by calling the method multiple times. The message is
set to perform action MQeAdminMsg.Action_RemoveAlias
.
The following basic fields are set:
The following fields are set in the Admin_Parms field.
The name of the connection to remove an alias from is specified using
method MQeAdminMsg.setName(java.lang.String)
or using
the constructor that takes the resource name or by setting
the MQeAdminMsg.Admin_Name
field.
alias
- the alias to remove from a connection.
java.lang.Exception
MQeAdminMsg.Action_RemoveAlias
,
Con_Aliases
public void update(java.lang.String adapter, java.lang.String parameters, java.lang.String options, java.lang.String channel, java.lang.String desc) throws java.lang.Exception
A method that assists the construction of a connection
administration message in order to update a connection. The message is
set to perform action MQeAdminMsg.Action_Update
.
The following basic fields are set:
The following fields are set in the Admin_Parms field.
The name of the connection to be updated is specified using
method MQeAdminMsg.setName(java.lang.String)
or using
the constructor that takes the resource name or by setting
the MQeAdminMsg.Admin_Name
field.
adapter
- File descriptor for the adapter.options
- Adapter optionschannel
- Type of channel to usedesc
- Description of connection
java.lang.Exception
MQeAdminMsg.Action_Update
MQeConnectionAdminMsg con = new MQeConnectionAdminMsg(); con.setName("ServerQM123"); con.update("Network:127.0.0.1:8082", null, null, "DefaultChannel", "Con to MQeServer");
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |