Setting up the Coordinated Request Reply with Global Cache sample

Before you run the Coordinated Request Reply Global Cache sample, configure the broker to use the default global cache. Set the following broker property by using the mqsichangebroker command.

mqsichangebroker MB8BROKER -b default

For the change to take effect, you must restart the broker.

Setting up the Coordinated Request Reply JMS application

In this sample, WebSphere MQ is used as the JMS provider. You must create the administered objects by using the JMSAdmin tool.

Before you start:

If you are running the sample on Linux, complete the following steps:

  1. Add the JMSAdmin class to the classpath by adding the following file to your classpath:
    <mq_install_directory>/java/lib/com.ibm.mqjms.jar
  2. Add the Java location to your PATH variable by including the following code in your classpath:
    <JAVA_HOME>/bin

Creating the administered objects by using JMSAdmin

The following instructions assume that WebSphere MQ is installed in the mq_install_dir directory. The JMSAdmin tool and JMSAdmin configuration file are in the following locations:

In the Coordinated Request Reply JMS application, you must use the JMSObjects.defs file with the JMSAdmin tool.

Before you can use the JMSAdmin tool, you must modify the JMSAdmin.config file.

Modifying the JMSAdmin.config file

To modify the JMSAdmin.config file, complete the following steps:

  1. In a text editor, open the JMSAdmin.config file.
  2. To comment out any options that are not required, add a number sign (#). To uncomment an option, remove the number sign (#).
    #  The following line specifies which JNDI service provider is in use.
    #  It currently indicates a File System Context. If a different
    #  service provider is used, this line must be commented out, and the
    #  appropriate one must be uncommented.
    #
    #  com.sun.jndi.fscontext.RefFSContextFactory is the FileSystem JNDI Context
    #
    #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
    #
    #  The following line specifies the URL of the initial context
    #  for the service provider. It currently refers to a File System Context. 
    #  Examples of an LDAP root context URL and the JNDI namespace for WebSphere 
    #  are also shown, commented out.
    #
    #PROVIDER_URL=ldap://localhost/o=ibm,c=us
    PROVIDER_URL=file:/C:/JNDI-Directory
    #PROVIDER_URL=iiop://localhost/	
    
  3. Ensure that the PROVIDER_URL is set to C:/JNDI-Directory, or an equivalent location on Linux, and INITIAL_CONTEXT_FACTORY is set to com.sun.jndi.fscontext.RefFSContextFactory.
  4. If you are running the sample on Windows, create the directory for the PROVIDER_URL, C:/JNDI-Directory

    If you are running the sample on Linux, create the directory for the PROVIDER_URL, /home/<myuser>/JNDI-Directory

  5. Save the file.
  6. Optional: change the port used in the sample. This sample uses the default port 2414. If the default queue manager (MB8QMGR) is listening on port 2414, skip this step. If the default queue manager is listening on a different port, you must change the port used in this sample.

    Use IBM Websphere MQ Explorer to determine on which port the queue manager is listening.

    To change the port used in the sample, complete the following steps:
    1. Change directory to "<workspace_path>/Coordinated Request Reply JMS Application" where workspace_path is the full path to the WebSphere Message Broker Toolkit workspace directory.
    2. Open the file JMSObjects.def for editing.
    3. Change the value of the parameter PORT to match the default queue manager port.
    4. Save your changes.

Now you can create the objects.

Creating the objects

By running the WebSphere MQ JMSAdmin tool, you create the JNDI administered objects to configure the JMS Connection Factories and Destinations that are used in the sample.

You create the objects by running JMSAdmin tool and by using the JMSObjects.defs file as input.

On the command line, enter the following commands:

where WebSphere MQ is installed in the following location: mq_install_dir, and workspace_path is the full path to the WebSphere Message Broker Toolkit workspace directory.

The objects and the .bindings file are created.

Configuring the JMS connection properties by using a single configurable service

The JMS connection properties for all JMS nodes used in this sample are configured by using the JMSProviders configurable service. To configure the JMS nodes with the Connection factory name and the location of the .bindings file that you have just created, complete the following step.

On the WebSphere Message Broker command console, enter the following command:

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 Request, Reply, BackendReplyApp, and RestoreOriginalJMSHeader flows, create a broker archive (BAR) file that contains all message flows.

To create the BAR file, complete the following steps.

  1. Right-click the Broker Development view, then click New > BAR file.
  2. Select the Coordinated Request Reply JMS application and enter a name for the BAR file.
  3. Add the Coordinated Request Reply JMS application to the BAR file, click Build broker archive, then save the file (Ctrl+S).
  4. In the Broker Development view, drag the BAR file to the default execution group in the Brokers view. This action deploys the flows onto the broker.

You are now ready to run the sample.

Back to running the sample