Configuring the resource adapter for outbound communication
To configure outbound communication, define the properties of a ConnectionFactory object and an administered destination object.
Example of using outbound communication
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
...
// Look up ConnectionFactory and Queue objects from the JNDI namespace
InitialContext ic = new InitialContext();
ConnectionFactory cf = (javax.jms.ConnectionFactory) ic.lookup("myCF");
Queue q = (javax.jms.Queue) ic.lookup("myQueue");
// Create and start a connection
Connection c = cf.createConnection();
c.start();
// Create a session and message producer
Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer pr = s.createProducer(q);
// Create and send a message
Message m = s.createTextMessage("Hello, World!");
pr.send(m);
// Create a message consumer and receive the message just sent
MessageConsumer co = s.createConsumer(q);
Message mr = co.receive(5000);
// Close the connection
c.close();
}
When the servlet receives an HTTP GET request, it retrieves
a ConnectionFactory object and a Queue object from the JNDI namespace,
and uses the objects to send a message to an IBM® MQ queue. The servlet then receives the message that it has sent.
Resources needed for outbound communication
- The properties of a ConnectionFactory object, which the application server uses to create a JMS ConnectionFactory object.
- The properties of an administered destination object, which the application server uses to create a JMS Queue object or JMS Topic object.
Typically, you define one ConnectionFactory object for each queue manager that applications might need to connect to. You define one Queue object for each queue that applications might need to access in the point-to-point domain. And you define one Topic object for each topic that applications might want to publish or subscribe to. A ConnectionFactory object can be domain independent. Alternatively, it can be domain-specific, a QueueConnectionFactory object for the point-to-point domain or a TopicConnectionFactory object for the publish/subscribe domain.
Properties of a ConnectionFactory object
Name of property | Type | Valid values (default value in bold) | Description |
---|---|---|---|
applicationName | String |
|
The name by which an application is registered with the queue manager. This application name is shown by the DISPLAY CONN MQSC/PCF command (where the field is called APPLTAG ) or in the IBM MQ Explorer Application Connections display (where the field is called App name ). |
brokerCCSubQueue 1 | String |
|
The name of the queue from which a connection consumer receives nondurable subscription messages. |
brokerControlQueue 1 | String |
|
The name of the broker control queue. |
brokerPubQueue 1 | String |
|
The name of the queue where published messages are sent (the stream queue). |
brokerQueueManager 1 | String |
|
The name of the queue manager on which the broker is running. |
brokerSubQueue 1 | String |
|
The name of the queue from which a nondurable message consumer receives messages.
See BROKERSUBQ property for more information. |
brokerVersion 1 | String |
|
The version of the broker being used. |
ccdtURL | String |
|
A URL that identifies the name and location of the file containing the client channel definition table (CCDT) and specifies how the file can be accessed. |
CCSID | String |
|
The coded character set identifier for a connection. |
channel | String |
|
The name of the MQI channel to use. |
cleanupInterval 1 | int |
|
The interval, in milliseconds, between background runs of the publish/subscribe cleanup utility. |
cleanupLevel 1 | String |
|
The cleanup level for a broker-based subscription store. |
clientID | String |
|
The client identifier for a connection. |
cloneSupport | String |
|
Whether two or more instances of the same durable topic subscriber can run simultaneously. |
connectionNameList | String |
|
A list of TCP/IP connection names used for outbound communications.
connectionNameList supersedes the hostname and port properties. This property is used to reconnect to multi-instance queue managers. connectionNameList is similar in form to localAddress, but must not be confused with it. localAddress specifies the characteristics of the local communications, whereas connectionNameList specifies how to reach a remote queue manager. |
failIfQuiesce | Boolean |
|
Whether calls to certain methods fail if the queue manager is in a quiescing state. |
headerCompression | String |
|
A list of the techniques that can be used for compressing header data on a connection. |
hostName | String |
|
The host name or IP address of the system on which the queue manager resides.
The hostname and port properties are superseded by the connectionNameList property when it is specified. |
localAddress | String |
|
For a connection to a queue manager, this property specifies either or both of the following:
localAddress is similar in form to connectionNameList, but must not be confused with it. localAddress specifies the characteristics of the local communications, whereas connectionNameList specifies how to reach a remote queue manager. |
messageCompression | String |
|
A list of the techniques that can be used for compressing message data on a connection. |
messageSelection 1 | String |
|
Determines whether message selection is done by IBM MQ classes for JMS or by the broker. Message selection by the broker is not supported when brokerVersion has the value 1. |
password | String |
|
The default password to use when creating a connection to the queue manager. |
pollingInterval 1 | int |
|
If each message listener within a session has no suitable message on its queue, this value is the maximum interval, in milliseconds, that elapses before each message listener tries again to get a message from its queue. If it frequently happens that no suitable message is available for any of the message listeners in a session, consider increasing the value of this property. This property is relevant only if TRANSPORT has the value BIND or CLIENT. |
port | int |
|
The port on which the queue manager listens.
The hostname and port properties are superseded by the connectionNameList property when it is specified. |
providerVersion | string |
|
The version, release, modification level and fix pack of the queue manager to which the application intends to connect. |
pubAckInterval 1 | int |
|
The number of messages published by a publisher before IBM MQ classes for JMS requests an acknowledgment from the broker. |
queueManager | String |
|
The name of the queue manager to connect to. |
receiveExit 3 | String |
|
Identifies a channel receive exit program, or a sequence of receive exit programs to be run in succession. |
receiveExitInit | String |
|
The user data that is passed to channel receive exit programs when they are called. |
rescanInterval 1 | int |
|
When a message consumer in the point-to-point domain uses a message selector to select which messages it wants to receive, IBM MQ classes for
JMS searches the IBM MQ queue for suitable messages in the sequence determined by the MsgDeliverySequence attribute of the queue. When IBM MQ classes for
JMS finds a suitable message and delivers it to the consumer, IBM MQ classes for
JMS resumes the search for the next suitable message from its current position in the queue. IBM MQ classes for
JMS continues to search the queue in this way until it reaches the end of the queue, or until the interval of time in milliseconds, as determined by the value of this property, has expired. In each case, IBM MQ classes for
JMS returns to the beginning of the queue to continue its search, and a new time interval commences. |
securityExit 3 | String |
|
Identifies a channel security exit program. |
securityExitInit | String |
|
The user data that is passed to a channel security exit program when it is called. |
sendCheckCount | int |
|
The number of send calls to allow between checking for asynchronous put errors, within a single non-transacted JMS session. |
sendExit 3 | String |
|
Identifies a channel send exit program, or a sequence of send exit programs to be run in succession. |
sendExitInit | String |
|
The user data that is passed to channel send exit programs when they are called. |
shareConvAllowed | Boolean |
|
Whether a client connection can share its socket with other top-level JMS connections from the same process to the same queue manager, if the channel definitions match. |
sparseSubscriptions 1 | Boolean |
|
Controls the message retrieval policy of a TopicSubscriber object. |
sslCertStores | String |
|
The Lightweight Directory Access Protocol (LDAP) servers that hold certificate revocation lists (CRLs) for use on an SSL connection. |
sslCipherSuite | String |
|
The CipherSuite to use for an SSL connection. |
sslFipsRequired 2 | Boolean |
|
Whether an SSL connection must use a CipherSuite that is supported by the IBM Java JSSE FIPS provider (IBMJSSEFIPS). |
sslPeerName | String |
|
For an SSL connection, a template that is used to check the distinguished name in the digital certificate provided by the queue manager. |
sslResetCount | int |
|
The total number bytes sent and received by an SSL connection before the secret keys used by SSL are renegotiated. |
sslSocketFactory | String | A string representing the fully qualified class name of a class providing an implementation of the javax.net.ssl.SSLSocketFactory interface, optionally including an argument to be passed to the constructor method, enclosed in parentheses. | Any connections established in the scope of the administered destination object use sockets obtained from this implementation of the SSLSocketFactory interface. |
statusRefreshInterval 1 | int |
|
The interval, in milliseconds, between refreshes of the long running transaction that detects when a subscriber loses its connection to the queue manager. This property is relevant only if SUBSTORE has the value QUEUE. |
subscriptionStore 1 | String |
|
Determines where IBM MQ classes for JMS stores persistent data about active subscriptions. |
targetClientMatching | Boolean |
|
Whether a reply message, sent to the queue identified by the JMSReplyTo header
field of an incoming message, has an MQRFH2 header only if the incoming message has an MQRFH2
header. You can also configure this property for an activation specification. For more information, see Configuring the targetClientMatching property for an activation specification. |
temporaryModel | String |
|
The name of the model queue from which JMS temporary queues are created.
Use SYSTEM.DEFAULT.MODEL.QUEUE if both of the following are true:
Use SYSTEM.JMS.TEMPQ.MODEL. in the following situations:
Define a new model queue with the DEFPSIST attribute set to YES, and the DEFSOPT attribute set to SHARED in the following situation:
|
tempQPrefix | String |
|
The prefix that is used to form the name of an IBM MQ dynamic queue. |
tempTopicPrefix | String | Any non-null string consisting only of valid characters for an IBM MQ topic string | When creating temporary topics, JMS generates a topic string of the form "TEMP/TEMPTOPICPREFIX/unique_id", or if this property is left with the default value, just "TEMP/unique_id". Specifying a non-empty TEMPTOPICPREFIX allows specific model queues to be defined for creating the managed queues for subscribers to temporary topics created under this connection. |
transportType | String |
|
Whether a connection to a queue manager uses client mode or bindings mode. If
the value BINDINGS_THEN_CLIENT is specified, the resource adapter first tries to make a connection
in bindings mode. If this connection attempt fails, the resource adapter then tries to make a client
mode connection. If an activation specification that is running on a WebSphere® Application Server for z/OS® system has been configured to use the BINDINGS_THEN_CLIENT transport mode and a previously established connection is broken, then any reconnection attempts by the activation specification first attempt to use the BINDINGS transport mode. If the BINDINGS transport mode connection attempt is unsuccessful, the activation specification subsequently attempts a CLIENT transport mode connection. |
username | String |
|
The default user name to use when creating a connection to a queue manager. |
wildcardFormat | int |
|
Which version of wildcard syntax is to be used. |
- This property can be used with Version 7.0 of IBM MQ classes for JMS but does not affect an application connected to a Version 7.0 queue manager unless the providerVersion property is set to a version number less than 7.
- For important information about using the sslFipsRequired property, see Limitations of the IBM MQ resource adapter.
- For information on how to configure the resource adapter so that it can locate an exit, see Configuring IBM MQ classes for JMS to use channel exits.
channel: SYSTEM.DEF.SVRCONN
hostName: 192.168.0.42
port: 1414
queueManager: ExampleQM
transportType: CLIENT
Properties of an administered destination object
The application server uses the properties of an administered destination object to create a JMS Queue object or JMS Topic object.
Name of property | Type | Valid values (default value in bold) | Description |
---|---|---|---|
CCSID | String |
|
The coded character set identifier for the destination. |
encoding | String |
|
The representation of binary integers, packed decimal integers, and floating point numbers for the destination. |
expiry | String |
|
The expiry time of a message sent to the destination. |
failIfQuiesce | String |
|
Whether an attempt to access the destination fails if the queue manager is in a quiescing state. |
messageBodyStyle | String |
|
You can set the messageBodyStyle property on JMS queues and topics: UNSPECIFIED(default)
JMS
MQ
|
persistence | String |
|
The persistence of a message sent to the destination. |
priority | String |
|
The priority of a message sent to the destination. |
putAsyncAllowed | String |
|
Whether message producers are allowed to use asynchronous puts to send messages to this destination. |
readAheadAllowed | int |
|
Whether message consumers and queue browsers are allowed to use read ahead to get nonpersistent messages from the destination into an internal buffer before receiving them. |
receiveCCSID | int |
|
Destination property that sets the target CCSID for queue manager message conversion. The value is ignored unless receiveConversion is set to QMGR |
receiveConversion | String |
|
Destination property that determines whether data conversion is going to be performed by the queue manager. |
targetClient | String |
|
Whether the target of a message sent to the destination is a JMS application. A message with a target that is a JMS application contains an MQRFH2 header. |
Name of property | Type | Valid values (default value in bold) | Description |
---|---|---|---|
baseQueueManagerName | String |
|
The name of the queue manager that owns the underlying IBM MQ queue. |
baseQueueName | String |
|
The name of the underlying IBM MQ queue. |
Name of property | Type | Valid values (default value in bold) | Description |
---|---|---|---|
baseTopicName | String |
|
The name of the underlying topic. |
brokerCCDurSubQueue 1 | String |
|
The name of the queue from which a connection consumer receives durable subscription messages. |
brokerDurSubQueue 1 | String |
|
The name of the queue from which a durable topic subscriber receives messages. See the BROKEDURRSUBQ property in the IBM MQ Explorer documentation for more information. |
brokerPubQueue 1 | String |
|
The name of the queue where published messages are sent (the stream queue). The value of this property overrides the value of the brokerPubQueue property of the ConnectionFactory object. However, if you do not set the value of this property, the value of the brokerPubQueue property of the ConnectionFactory object is used instead. |
brokerPubQueueManager 1 | String |
|
The name of the queue manager that owns the queue where messages published on the topic are sent. |
brokerVersion 1 | String |
|
The version of the broker being used. The value of this property overrides the value of the brokerVersion property of the ConnectionFactory object. However, if you do not set the value of this property, the value of the brokerVersion property of the ConnectionFactory object is used instead. |
- This property can be used with Version 7.0 of IBM MQ classes for JMS but does not affect an application connected to a Version 7.0 queue manager unless the providerVersion property of the ConnectionFactory object is set to a version number less than 7.
expiry: UNLIM
persistence: QDEF
baseQueueManagerName: ExampleQM
baseQueueName: SYSTEM.JMS.TEMPQ.MODEL
expiry: UNLIM
persistence: NON
baseTopicName: myTestTopic