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

You can use scripting to configure a new connection factory for the WebSphere® MQ messaging provider.

Before you begin

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

Before starting this task, the wsadmin tool must be running.

About this task

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

Procedure

  1. Identify the parent ID:
    • Using Jacl:

      set newjmsp [$AdminConfig getid /Cell:mycell/Node:mynode/
      JMSProvider:WebSphere MQ JMS Provider/]
    • Using Jython:
      newjmsp = AdminConfig.getid('/Cell:mycell/Node:myNode/
      JMSProvider:WebSphere MQ JMS Provider')
      print newjmsp
    Example output:
    WebSphere MQ JMS Provider(cells/mycell/nodes/mynode|
    resources.xml#builtin_mqprovider)
  2. Get the required attributes:
    • Using Jacl:

      $AdminConfig required MQConnectionFactory
    • Using Jython:
      print AdminConfig.required('MQConnectionFactory')
    Example output:
    attribute    Type
    name         String
    jndiName     String
    
  3. Set up the required attributes:
    • Using Jacl:

      set name [list name MQCF]
      set jndi [list jndiName jms/MQCF]
      set mqcfAttrs [list $name $jndi]
      Example output:
      {name MQCF} {jndiName jms/MQCF}
    • Using Jython:
      name = ['name', 'MQCF']
      jndi = ['jndiName', 'jms/MQCF']
      mqcfAttrs = [name, jndi]
      print mqcfAttrs
      Example output:
      [[name, MQCF], [jndiName, jms/MQCF]]
  4. Set up a template:
    • Using Jacl:

      set template [lindex [$AdminConfig listTemplates MQConnectionFactory] 0]
    • Using Jython:

      import java
      lineseparator = java.lang.System.getProperty('line.separator')
      template = 
      AdminConfig.listTemplates('MQConnectionFactory').split(lineseparator)[0]
      print template 
    Example output:
    Example non-XA WMQ ConnectionFactory(templates/
    system:JMS-resource-provider-templates.xml
    #MQConnectionFactory_3)
    
  5. Create a connection factory for the WebSphere MQ messaging provider:
    • Using Jacl:

      $AdminConfig createUsingTemplate MQConnectionFactory 
      $newjmsp $mqcfAttrs $template
    • Using Jython:
      print AdminConfig.createUsingTemplate('MQConnectionFactory', 
      newjmsp, mqcfAttrs, template)
    Example output:
    MQCF(cells/mycell/nodes/mynode:resources.xml#MQConnectionFactory_1)
  6. Save the configuration changes.
  7. In a network deployment environment only, synchronize the node.

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:9994GKCNode01 
9994GKCNode01(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.




In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Oct 20, 2010 7:53:43 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-nd-dist&topic=txml_mqconn
File name: txml_mqconn.html