Configuring the hub for the JMS transport protocol

You installed WebSphere MQ as part of the installation of WebSphere Business Integration Connect. WebSphere MQ includes a JMS implementation, which you can use to set up JMS communication.

WebSphere MQ is not configured for JMS by default, however. This section provides the steps to configure JMS.

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 run time to your environment

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

set PATH=%PATH%;<path to installation directory>\_jvm\jre\bin 

where installation directory refers to the directory where WebSphere Business Integration Connect 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(jms)
    change ctx(jms) 
  4. From the InitCtx/jms> prompt, enter the following JMS configuration:
    define qcf(WBICHub) 
        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

As an example, the following is the JMSAdmin session used to define the queue connection factory as WBICHub, 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(WBICHub) 
    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 

Copyright IBM Corp. 2003, 2004