Set a new connection factory for the WebSphere MQ messaging provider using scripting


 

+

Search Tips   |   Advanced Search

 

Use scripting to configure a new connection factory for the WebSphere MQ messaging provider.

We can also use the createWMQConnectionFactory to create a connection factory for the WebSphere MQ messaging provider.

Perform the following steps to configure a connection factory for the WebSphere MQ messaging provider:

Jacl...

### Identify the parent ID:
set newjmsp [$AdminConfig getid /Cell:mycell/Node:mynode/JMSProvider:WebSphere MQ JMS Provider/]

### Get the required attributes:

$AdminConfig required MQConnectionFactory

### Set up the required attributes:

set name [list name MQCF]
set jndi [list jndiName jms/MQCF]
set mqcfAttrs [list $name $jndi]

### Set up a template:

set template [lindex [$AdminConfig listTemplates MQConnectionFactory] 0]

### Create a connection factory for the WebSphere MQ messaging provider:

$AdminConfig createUsingTemplate MQConnectionFactory
$newjmsp $mqcfAttrs $template

### Save the configuration changes.
### Synchronize nodes

Jython...

newjmsp = AdminConfig.getid('/Cell:mycell/Node:myNode/JMSProvider:WebSphere MQ JMS Provider')
print newjmsp
print AdminConfig.required('MQConnectionFactory')
name = ['name', 'MQCF']
jndi = ['jndiName', 'jms/MQCF']
mqcfAttrs = [name, jndi]
print mqcfAttrs
import java
lineseparator = java.lang.System.getProperty('line.separator')
template =
AdminConfig.listTemplates('MQConnectionFactory').split(lineseparator)[0]
print template
print AdminConfig.createUsingTemplate('MQConnectionFactory',
newjmsp, mqcfAttrs, template)

### Save the configuration changes.
### Synchronize nodes

 

Example

The following example creates a connection factory, specifying custom connection data. Due to the default values assumed for the unspecified parameters, applications using this connection factory expect to be co-located with a queue manager installed on the same node.

wsadmin>$AdminConfig getid /Node:9994GKCNode019994GKCNode01(cells/9994GKCNode01Cell/nodes/9994GKCNode01|node.xml#Node_1)

wsadmin>$AdminTask createWMQConnectionFactory 9994GKCNode01(cells/9994GKCNode01Cell/nodes/9994GKCNode01|node.xml#Node_1) {-name cf1 -jndiName "jms/cf/cf1" -type CF} cf1(cells/9994GKCNode01Cell/nodes/9994GKCNode01|resources.xml#MQConnectionFactory_1205322636000)

The following example creates an connection factory for which the user must specify and maintain all the parameters used for establishing a connection to WebSphere MQ.

Jython...

wsadmin>AdminConfig.getid("/Node:9994GKCNode01") 9994GKCNode01(cells/9994GKCNode01Cell/nodes/9994GKCNode01|node.xml#Node_1)

wsadmin>AdminTask.createWMQConnectionFactory("9994GKCNode01(cells/9994GKCNode01Cell/nodes/9994GKCNode01|node.xml#Node_1)", ["-name cf2 -jndiName 'jms/cf/cf2' -type CF -description 'Must remember to keep each of these connection factories in sync with the WebSphere MQ queue manager to which they refer' -qmgrName QM1 -qmgrHostname 192.168.0.22 -qmgrPort 1415 -qmgrSvrconnChannel QM1.SVRCONN"]) cf2(cells/9994GKCNode01Cell/nodes/9994GKCNode01|resources.xml# MQConnectionFactory_120532263601)

Jacl...

wsadmin>$AdminConfig getid /Node:9994GKCNode019994GKCNode01(cells/9994GKCNode01Cell/nodes/9994GKCNode01|node.xml#Node_1)

wsadmin>$AdminTask createWMQConnectionFactory 9994GKCNode01(cells/9994GKCNode01Cell/nodes/9994GKCNode01|node.xml#Node_1) {-name cf2 -jndiName "jms/cf/cf2" -type CF -description "Must remember to keep each of these connection factories in sync with the WebSphere MQ queue manager to which they refer" -qmgrName QM1 -qmgrHostname 192.168.0.22 -qmgrPort 1415 -qmgrSvrconnChannel QM1.SVRCONN} cf2(cells/9994GKCNode01Cell/nodes/9994GKCNode01|resources.xml#MQConnectionFactory_120532263601)

 

Related tasks

Use the AdminConfig object for scripted administration

 

Related

Commands for the AdminConfig object
createWMQConnectionFactory