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:
- Open the JMSAdmin.config file in a text editor.
- 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
#
- 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.
- 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:
- On Windows:
cd mq_install_dir\Java\bin
JMSAdmin < "workspace_path\JMS Nodes Sample Flow\JMSSampleObjects.defs"
- On Linux:
cd mq_install_dir/java/bin
./JMSAdmin < "workspace_path/JMS Nodes Sample Flow/JMSSampleObjects.defs"
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:
- Start the JMSAdmin tool.
- On the command line enter the following command to modify this JNDI object:
alter q(publishqueue) queue(PUBLISHQUEUE)
- In the Message Brokers Toolkit, switch to the Broker Administration perspective and open the JMSGateway flow in the Message Flow editor.
- Right-click the MQInput node, then click Properties....
- 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.
- Copy the the WebSphere MQ JMS Provider implementation JAR files into the appropriate location:
- On Windows, copy all the JAR files from install_dir\java\lib, where install_dir is the installation path of WebSphere MQ, to the following location:
Documents and Settings\All Users\Application Data\IBM\MQSI\shared-classes
- On Linux, copy all the JAR files from install_dir/java/lib, where install_dir is the installation path of WebSphere MQ, to the following location:
/var/mqsi/shared-classes
- 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:
- In the Message Brokers Toolkit, switch the Application Development perspective.
- Open the JMSGateway message flow in the Message Flow editor.
- Right-click the
JMSOutput node in the message flow, then click Properties to open the Properties dialog.
- In the Location JNDI Bindings field, type the path that is specified in the PROVIDER_URL line in the JMSAdmin.config file.
- On Windows, type file:/C:\JNDI-Directory
- On Linux, type file:///home/<myuser>/JNDI-Directory where <myuser> is the user name that you use when you run the broker.
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.
- Click OK to close the Properties dialog.
- 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:
- In the Message Brokers Toolkit, switch to the Broker Administration Domain perspective.
- In the Domans view, right-click, then click New > Message Broker Archive, and enter a name for the BAR file.
- Add both flows to the BAR file, then save the file (Ctrl+S).
- 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