Configuring the hub for the JMS transport protocol

This section describes how to set up the hub to use the JMS transport. If you will be using the JMS transport to send documents from the hub or to receive documents at the hub, follow the procedures in this section. If you will not be using the JMS transport, skip this section.

Note: The procedures in this section describe how to use the JMS implementation of WebSphere MQ to set up the JMS environment. The procedures also describe how to set up local queues. If you want to set up transmission and remote queues, refer to the WebSphere MQ documentation.

In later sections of this document, you will learn how to set up JMS targets or gateways (or both). These tasks are described in Setting up a JMS target and Setting up a JMS gateway.

Creating a directory for JMS

You first create a directory for JMS. For example, suppose you wanted to create a directory named JMS in the c:\temp directory of a Windows installation. These are the steps you would follow:

  1. Open Windows Explorer.
  2. Open the C:\temp directory.
  3. Create a new folder named JMS.

Modifying the default JMS configuration

In this section, you update the JMSAdmin.config file, which is part of the WebSphere MQ installation, to change the context factory and provider URL.

  1. Navigate to the Java\bin directory of WebSphere MQ. For example, in a Windows installation, you would navigate to: C:\IBM\MQ\Java\bin
  2. Open the JMSAdmin.config file using a plain text editor, such as Notepad or vi.
  3. Add the character # to the front of the following lines:
    INITIAL_CONTEXT_FACTORY=com.sun.jndi.ldap.LdapCtxFactory
    PROVIDER_URL=ldap://polaris/o=ibm,c=us
  4. Remove the character # from the front of the following lines:
    #INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory 
    #PROVIDER_URL=file:/C:/JNDI-Directory
  5. Change the PROVIDER_URL=file:/C:/JNDI-Directory line to equal the name of the JMS directory you set up in Creating a directory for JMS. For example, if you set up the c:/temp/JMS directory, the line would look like this:
    PROVIDER_URL=file:/c:/temp/JMS
  6. Save the file.

Creating queues and the channel

In this section, you use WebSphere MQ to create the queues you will use to send and receive documents and the channel for this communication. It is assumed that a queue manager has been created. The name of the queue manager should be substituted where <queue_manager_name> appears in the following steps. It is also assumed that a listener for this queue manager has been started on TCP port 1414.

  1. Open a command prompt.
  2. Enter the following command to start the WebSphere MQ command server:
    strmqcsv <queue_manager_name>
  3. Enter the following command to start the WebSphere MQ command environment:
    runmqsc <queue_manager_name>
  4. Enter the following command to create a WebSphere MQ queue to be used to hold incoming documents sent to the hub:
    def ql(<queue_name>)

    For example, to create a queue named JMSIN, you would enter:

    def ql(JMSIN)
  5. Enter the following command to create a WebSphere MQ queue to be used to hold documents sent from the hub:
    def ql(<queue_name>)

    For example, to create a queue named JMSOUT, you would enter:

    def ql(JMSOUT)
  6. Enter the following command to create a WebSphere MQ channel to be used for documents sent to and from the hub:
    def channel(<channel_name>) CHLTYPE(SVRCONN)

    For example, to create a channel named java.channel, you would enter:

    def channel(java.channel) CHLTYPE(SVRCONN)
  7. Enter the following command to exit the WebSphere MQ command environment:
    end

Adding a Java(TM) run time to your environment

Enter the following command to add a Java run time to your system path:

set PATH=%PATH%;<ProductDir>\_jvm\jre\bin 

where ProductDir refers to the directory where WebSphere Partner Gateway is installed.

Defining the JMS configuration

To define the JMS configuration, perform the following steps:

  1. Change to the WebSphere MQ Java directory (directory (<path_to_Websphere_MQ_installation_directory>\java\bin)
  2. Start the JMSAdmin application by typing the following command:
    JMSAdmin
  3. Define a new JMS Context by typing the following commands from the InitCtx> prompt:
    define ctx(<context_name>)
    change ctx(<context_name>)

    For example, if the context_name is JMS, the commands look like this:

    define ctx(JMS)

    change ctx(JMS) 
  4. From the InitCtx/jms> prompt, enter the following JMS configuration:
    define qcf(connection_factory_name) 
        tran(CLIENT) 
        host(<your_IP_address>) 
        port(1414) 
        chan(java.channel) 
        qmgr(<queue_manager_name>)
    define q(<name>) queue(<queue_name>) qmgr(<queue_manager_name>)
    define q(<name>) queue(<queue_name>) qmgr(<queue_manager_name>)
    end

The previous steps created the .bindings file, which is located in a subfolder of the folder you specified in step 5. The name of the subfolder is the name you specified for your JMS context.

As an example, the following JMSAdmin session is used to define the queue connection factory as Hub, with an IP address of sample.ibm.com where the MQ queue manager resides (<queue_manager_name> of sample.queue.manager). The example uses the JMS queue names and channel name created in Creating queues and the channel. Note that user input follows the > prompt.

InitCtx> define ctx(jms)
InitCtx> change ctx(jms) 
InitCtx/jms> define qcf(Hub) 
    tran(CLIENT) 
    host(sample.ibm.com) 
    port(1414) 
    chan(java.channel) 
    qmgr(sample.queue.manager) 
InitCtx/jms> define q(inQ) queue(JMSIN) qmgr(sample.queue.manager) 
InitCtx/jms> define q(outQ) queue(JMSOUT) qmgr(sample.queue.manager) 
InitCtx/jms>end 

In this example, the .bindings file would be located in the following directory: c:/temp/JMS/JMS, where c:/temp/JMS is the PROVIDER_URL and JMS is the context name.

Copyright IBM Corp. 2003, 2005