Add the Java bin subdirectory
to the PATH environment variable.
About this task
If we use the name of the queue manager as the first
part of the channel name, MQIPT need
use only one route to service all connection requests. For example,
to connect to QM1, the name of a SVRCONN channel might be QM1.MQIPT.CHANNEL.
The list of queue manager and server names to be used is
read from a configuration file. The name and location of the configuration
file, called SampleOneRouteExit.conf, is defined
with the MQIPT SecurityExitName and SecurityExitPath properties.
Figure 1. Dynamic one route exit network diagram
This diagram shows the connection flow from the IBM MQ client (called client1.company1.com
on port 1415) through MQIPT to three IBM MQ servers (called server1.company2.com,
server2.company2.com, and server3.company2.com).
Procedure
To dynamically route client connection requests, complete
the following steps:
Create three different queue managers on three separate
servers. Each queue manager has a SVRCONN channel named
after itself, for example, QM1.MQIPT.CHANNEL on queue manager QM1,
and an empty local queue named MQIPT.LOCAL.QUEUE.
On MQIPT1:
In the mqipt_path\exits subdirectory (where mqipt_path is the location where MQIPT is installed), create a sample configuration file, called SampleRoutingExit.conf that contains the names of your three queue managers:
Ensure that there are no blank lines before the first entry in the file and
that each entry is a valid server name. If we have used different
server names, change these names to match your environment.
You
must change these server names to match your environment. Note that
all queue manager names in the list must be unique. If you list the
same name more than once, even if the queue managers are on different
servers, only the last entry for that name is registered.
Open a command prompt and enter the following commands:
C:
cd \mqipt\exits
javac -classpath C:\mqipt\lib\com.ibm.mq.ipt.jar;. SampleOneRouteExit.java
where C:\mqiptHome
indicates the location of the MQIPT configuration file,
mqipt.conf.The following message indicates successful completion:
5639-L92 (C) Copyright IBM Corp. 2000, 2017 All Rights Reserved
MQCPI001 IBM MQ Internet Pass-Thru Version 2.1.0.0 starting
MQCPI004 Reading configuration information from C:\mqiptHome\mqipt.conf
MQCPI011 The path C:\mqiptHome\logs will be used to store the log files
MQCPI006 Route 1415 has started and will forward messages to :
MQCPI034 ....server1.company2.com(1414)
MQCPI035 ....using MQ protocols
MQCPI079 ....using security exit C:\mqipt\exits\SampleOneRouteExit
MQCPI080 ......and timeout of 5 seconds
MQCPI078 Route 1415 ready for connection requests
At a command prompt on the IBM MQ client,
enter the following commands:
Set the MQSERVER environment variable:
SET MQSERVER=QM1.MQIPT.CHANNEL/TCP/10.9.1.2(1415)
Put a message:
amqsputc MQIPT.LOCAL.QUEUE QM1
Hello world 1
Press Enter twice after typing the message
string.
Get the message:
amqsgetc MQIPT.LOCAL.QUEUE QM1
The message, Hello world 1 is returned.
Reset the MQSERVER environment
variable:
SET MQSERVER=QM2.MQIPT.CHANNEL/TCP/10.9.1.2(1415)
Put a message:
amqsputc MQIPT.LOCAL.QUEUE QM2
Hello world 2
Press Enter twice after typing the message
string.
Get the message:
amqsgetc MQIPT.LOCAL.QUEUE QM2
The message, Hello world 2 is returned.
Reset the MQSERVER environment
variable again:
SET MQSERVER=QM3.MQIPT.CHANNEL/TCP/10.9.1.2(1415)
Put a message:
amqsputc MQIPT.LOCAL.QUEUE QM3
Hello world 3
Press Enter twice after typing the message
string.