Example of use of command-line tools

The command-line tools can be used to create an initial queue manager configuration using a script, and without needing to know how to program in the Java programming language.

The following example demonstrate how to use these tools to configure the network topology shown in the following figure.

Figure 8. WebSphere MQ Everyplace administration scenario

Graphic showing three branch offices (Branch000, Branch001, and branch002) connected to a central office WebSphere MQ Everyplace server (GATEWAY00) that is itself connected, through a LAN to a WebSphere MQ server (CENTRAL00)

In this scenario:

Script files required

The following scripts are needed to configure this network topology.

Central.tst
Used with the runmqsc script to create relevant objects on CENTRAL00QM

CentralQMDetails.bat
Used to describe the CENTRAL00QM to other scripts

GatewayQMDetails.bat
Used to describe the GATEWAY00QM to other scripts

CreateGatewayQM.bat
Used to create the gateway queue manager

CreateBranchQM.bat
Used to create a branch queue manager

These .bat files can all be found in the installed product, in MQe\Java\Demo\Windows.

Note:
Although the example scripts provided are in the Windows(R) .bat file format, they could be converted to work equally well in any scripting language available on your system.

WebSphere MQ Everyplace and WebSphere MQ objects defined by the scripts

The following objects are created by the scripts, to provide the branch-to-central routing:

Figure 9. Branch to central routing

Diagram showing branch-to-central routing.

The following objects are created by the scripts to provide the central-to-branch routing:

Figure 10. Central to branch routing

Diagram showing central-to-branch routing.

How to use the script files

Follow these procedures to create the required objects and operate the example scenario, using the supplied script files.

Edit the JavaEnv.bat .
Make sure you have edited the JavaEnv.bat file to set your required working environment.

Create a command-line session
Create a command-line session, and invoke the JavaEnv.bat to make the settings available in the current environment.

Gather hardware required
Locate all the hardware on which you will be installing the network topology.

Gather the machine names of those machines available to you, and note them down. If you have only one machine available, you can still use the scripts to deploy the example network topology, as you can specify the same hostname for each queue manager.

Create a WebSphere MQ queue manager
By default, the scripts assume this is called CENTRAL00QM listening on port 1414 for client channel connections.

Describe the WebSphere MQ queue manager
Edit and review the CentralQMDetails.bat file to make sure that its details match those of the WebSphere MQ queue manager you have just created. All values, except the name of the machine on which the WebSphere MQ queue manager sits, are defaulted in the script file.

Describe the gateway queue manager
Edit and review the GatewayQMDetails.bat file to make sure that details of the gateway queue manager are decided on, and available for the other .bat files to use.

The default name of the gateway queue manager created by the scripts is GATEWAY00QM. You will need to set the machine name, and port number it will listen on. This port must be available for use.

Tip: On Windows machines, use the command netstat -a to get a list of ports currently in use.

Review the central.tst file
Read the central.tst file, make sure it won't create any WebSphere MQ objects you are unhappy with on your WebSphere MQ queue manager.

Distribute all the scripts to all machines
Copy all of the scripts to all of the machines on which you will be running WebSphere MQ Everyplace queue managers.

This step spreads knowledge to all the machines in your network, of the host names, port numbers, and queue manager names that you have decided to use. If any of these files are changed, delete all WebSphere MQ Everyplace queue managers and restart from this point in the instructions.

Run the central.tst script on your new WebSphere MQ queue manger
The central.tst script is in a format used by the runmqsc sample program supplied with WebSphere MQ.

Pipe the central.tst file into runmqsc to configure your WebSphere MQ queue manger For example:

runmqsc CENTRAL00QM < Central.tst

Use the WebSphere MQ Explorer to view the resultant WebSphere MQ objects that are created.

Milestone: You have now set up your WebSphere MQ system.

Run the CreateGatewayQM script
The CreateGatewayQM script uses the details in the CentralQMDetails and GatewayQMDetails scripts to create a gateway queue manager.

The script needs no parameters.

Check for the test message
The script that creates the queue manager sends a test message to the WebSphere MQ system.

Use the WebSphere MQ Explorer tool to look at the target queue (BRANCH.SALES.QUEUE by default) to make sure a test message arrived. The body of the test message contains the string ABCD

Milestone: You have now set up your WebSphere MQ Everyplace gateway queue manager.

Keep the gateway queue manager running
During the running of the CreateGatewayQM script, an example server program is invoked to start the gateway queue manager, and keep it running. An AWT application runs, displaying a window on the screen.Do not close this window.

All the time this window is active, the WebSphere MQ Everyplace gateway queue manager it represents is also active. Closing the window closes the WebSphere MQ Everyplace gateway queue manager and breaks the path from the branch queue managers to the WebSphere MQ queue manager.

Create a branch queue manager
If your branch queue manager needs to run on a different machine, you may need to edit the JavaEnv.bat file to set up your local environment.

Create a command-line session, and call JavaEnv.bat as before to set up your environment.

Use the CreateBranchQM script to create a branch queue manager. The syntax of the command is :

CreateBranchQM.bat branchNumber portListeningOn

Where:

branchNumber
Is a 3-digit number, padded with leading zeros, indicating which branch the queue manager is being created for. For example, 000, 001, 002...

portListeningOn
Is a port on which the device branch queue manager listens on for administration requests. For example, 8082, 8083...
Note:
The port must not already be in use
Hint: On Windows machines, use the netstat -a command to view the list of ports in use.

During the script, a test message is sent to your WebSphere MQ system. Use the WebSphere MQ Explorer to make sure the test message arrived successfully. The body of the test message contains the string ABCD.

At the end of the script, an example program is used to start the WebSphere MQ Everyplace queue manager. An AWT application runs, displaying a window on the screen.As with the gateway queue manager, do not close this window until you wish to close the queue manager.

Explore the branch queue manager
The branch queue manager is set up with a channel manager and listener, on the port you specified when you created it, and the Primary Network connection is HttpTcpipAdapter. As a result, you can use the MQe_Explorer to view the queue managers. Refer to How to use the MQe_Explorer to view the configurations.

Milestone: You now have a branch queue manager set up.

Note:
An WebSphere MQ Everyplace queue manager should be named uniquely. Never create two queue managers with the same name.

Start the MQe_Explorer.exe program. Stop one of the branch queue managers, say BRANCH002QM Open the BRANCH002QM.ini file, and navigate from there.

How to use the MQe_Explorer to view the configurations

To use the MQe_Explorer to view your configuration:

  1. Start the MQe_Explorer.exe program.
  2. Stop one of the branch queue managers, say BRANCH002QM
  3. Open the BRANCH002QM.ini file, and navigate from there.


© IBM Corporation 2002, 2003. All Rights Reserved