Setting up the JMS Nodes sample

Before running the JMS Nodes sample you must create JNDI administered objects. In the sample WebSphere MQ is used as the JMS provider, so you must create the administered objects in the JMSAdmin tool.

Creating the administered objects using JMSAdmin

The JMSAdmin tool is located in install_dir/java/bin on Linux, and install_dir\java\bin on Windows, where install_dir is the directory in which WebSphere MQ is installed.

In the JMS Nodes Sample Flow project, there is one file you need to use with the JMSAdmin tool: JMSSampleObjects.defs

Before using the JMSAdmin tool, modify the JMSAdmin.config file as follows.

Modifying the JMSAdmin.config file

To modify the JMSAdmin.config file:

  1. Open the JMSAdmin.config file in a text editor.
  2. On Windows and Linux, remove the # sign, as shown, to uncomment the line highlighted in bold:
    # The following line specifies which JNDI service provider is in use.
    # It currently indicates an LDAP service provider. If a different
    # service provider is used, this line should be commented out and the
    # appropriate one should be uncommented.
    #
    #INITIAL_CONTEXT_FACTORY=com.sun.jndi.ldap.LdapCtxFactory
    INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
    #INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory
    #INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory
    #
  3. On Windows only, remove the # sign, as shown, to uncomment the line highlighted in bold:
    # The following line specifies the URL of the service provider's initial
    # context. It currently refers to an LDAP root context. Examples of a
    # file system URL and WebSphere's JNDI namespace are also shown, commented out.
    #
    #PROVIDER_URL=ldap://polaris/o=ibm,c=us
    PROVIDER_URL=file:/C:/JNDI-Directory
    #PROVIDER_URL=iiop://localhost/
    #

    When you have saved the file, create the JNDI-Directory directory as it appears in the PROVIDER_URL line.

  4. On Linux only, remove the # sign, as shown, to uncomment the line highlighted in bold, then replace user_name with the user name that you use to run the broker. When you have saved the file, create the JNDI-Directory directory as it appears in the PROVIDER_URL line.
    # The following line specifies the URL of the service provider's initial
    # context. It currently refers to an LDAP root context. Examples of a
    # file system URL and WebSphere's JNDI namespace are also shown, commented out.
    #
    #PROVIDER_URL=ldap://polaris/o=ibm,c=us
    PROVIDER_URL=file:///home/user_name/JNDI-Directory
    #PROVIDER_URL=iiop://localhost/
    #

Now you are ready to create the objects.

Creating the objects

You need to create the JNDI administered objects to configure the JMS Connection Factories and Destinations used in the sample by running the WebSphere MQ JMSAdmin tool. This takes the JMSSampleObjects.defs file as input. You create the objects by running JMSAdmin, using the JMSSampleObjects.defs file as input.

On the command line, enter the following commands:

Where mq_install_dir is the location in which WebSphere MQ is installed, and workspace_path is the full path to the Message Brokers Toolkit workspace directory.

The objects and the .bindings file are created.

Next, modify a JNDI object and an MQInput node attribute:

  1. Start the JMSAdmin tool.
  2. On the command line enter the following command to modify this JNDI object:
    alter q(publishqueue) queue(PUBLISHQUEUE)
  3. In the Message Brokers Toolkit, switch to the Broker Administration perspective and open the JMSGateway flow in the Message Flow editor.
  4. Right-click the MQInput node, then click Properties....
  5. In the Queue Name field change the value from inputqueue to INPUTQUEUE, then click OK.

Copy WebSphere MQ JMS Provider JAR files

You need to copy the WebSphere MQ JMS Provider implementation JAR files into a location that WebSphere Message Brokers recognizes.

  1. Copy the the WebSphere MQ JMS Provider implementation JAR files into the appropriate location:
  2. Restart the broker.

Configuring the JNDI path in the message flows

You need to tell the JMS nodes in the message flows where to find the .bindings file that you just created.

To configure the JMS nodes with the location of the .bindings file:

  1. In the Message Brokers Toolkit, switch the Application Development perspective.
  2. Open the JMSGateway message flow in the Message Flow editor.
  3. Right-click the JMSOutput node in the message flow, then click Properties to open the Properties dialog.
  4. In the Location JNDI Bindings field, type the path that is specified in the PROVIDER_URL line in the JMSAdmin.config file. Ensure that the path that you type in the node properties matches the path in the JMSAdmin.config file. If the two paths do not match, the message flows will not work.
  5. Click OK to close the Properties dialog.
  6. Open the JMSInput_Publication message flow in the Message Flow editor, and configure the JMSInput node with the location of the .bindings file in the same way.

The message flows are now configured, and are ready to be deployed to the broker.

Creating the BAR file and deploying the message flows

To deploy the JMSGateway and JMSInput_Publication flows, create a broker archive (BAR) file that contains both message flows.

To create the BAR file:

  1. In the Message Brokers Toolkit, switch to the Broker Administration Domain perspective.
  2. In the Domans view, right-click, then click New > Message Broker Archive, and enter a name for the BAR file.
  3. Add both flows to the BAR file, then save the file (Ctrl+S).
  4. In the Broker Administration Navigator view, click the BAR file and drag it to the default execution group in the Domains view. This deploys the flows onto the broker.

You are now ready to run the sample.

Back to sample home