How to setup Hub and Spoke IBM MQ Managed File Transfer network - ibm-messaging/mq-mft GitHub Wiki
IBM MQ Managed File Transfer (MFT) transfers files between systems in a managed and auditable way, regardless of file size or the operating systems used. IBM MQ Managed File Transfer can be used to build a customized, scalable, and automated file transfer solution that is trusted and secure. Since IBM MQ Managed File Transfer runs on top of an existing IBM MQ network, it eliminates costly redundancies, lowers maintenance costs, and maximizes your existing IT investments. More details on IBM MQ Managed File Transfer is found here.
Agents are the key components of IBM MQ Managed File Transfer which transfer files from one point to another point over IBM MQ network.
The diagram below shows a IBM MQ Managed File Transfer topology. There are two agents, each connect to their own agent queue manager in an IBM MQ network. A file is transferred from the agent SRC_AGENT
through the IBM MQ network to agent DEST_AGENT
.
In the above configuration, agent queue manager doubles up as command queue manager also. A command queue manager is used to send commands to an agent. Apart from agent queue managers, there are is another queue manager in the network, the coordination queue manager. Applications and tools like MQExplorer connect to these queue managers to configure, administer, operate, and log IBM MQ Managed File Transfer activity in the IBM MQ network. It is also possible to develop your dashboards with help of messages publsihed by MFT.
In a typical MFT setup, agents connect to their own queue manager, either in server bindings or client bindings mode. Agents do not directly connect to the coordination queue manager, instead they connect to the coordination queue manager via their agent queue manager. The communication between agent queue managers and the coordination queue manager will often be trusted and secure. In fact the only time when agents directly connect to coordination queue manager if the coordination queue manager also happens to be one of the agent queue managers.
In this document we describe how to setup a Hub & Spoke style of IBM MFT network where the coordination queue manager acts as Hub and agent queue managers act as Spokes. All communication is routed through the hub queue manager. The picture above describes the architecture of the setup.
The setup uses three machines with machine 1 hosting coordination queue manager while the other two machines host agent queue managers. All machines have installed MQ v8.0.0.2.
In this setup there are three queue managers:
QMCORD - The coordination queue manager on machine 1
QMSRC - Agent queue manager on machine 2
QMDEST - Agent queue manager on machine 3
The agent queue managers also act as command queue managers.
Run the commands below on machine 1 to create and start queue manager QMCORD.
crtmqm QMCORD
strmqm QMCORD
Run the commands below on machine 2 to create and start queue manager QMSRC.
crtmqm QMSRC
strmqm QMSRC
Run the commands below on machine 3 to create and start queue manager QMDEST.
crtmqm QMDEST
strmqm QMDEST
On machine 1 run MQSC console.
runmqsc QMCORD
Issue following commands in MQSC console
Setup a dead letter queue for the queue manager.
ALTER QMGR DEADQ(SYSTEM.DEAD.LETTER.QUEUE)
Define a TCP listener
DEF LISTENER (TCP_LISTENER) TRPTYPE(TCP) CONTROL(QMGR) PORT(1414)
Start the listener
START LISTENER(TCP_LISTENER)
Define a transmit queue to be used by sender channel to QMSRC queue manager
DEF QL(QMSRC) USAGE(XMITQ)
Define a transmit queue to be used by sender channel to QMDEST queue manager
DEF QL(QMDEST) USAGE(XMITQ)
Define sender channel to QMSRC queue manager
DEF CHANNEL(QMCORD_TO_QMSRC) CHLTYPE(SDR) CONNAME('qmsrcmc.mycomp.com(1415)') XMITQ(QMSRC) REPLACE
Define receiver channel for QMSRC queue manager
DEF CHANNEL(QMSRC_TO_QMCORD) CHLTYPE(RCVR) REPLACE
Define sender channel to QMDEST queue manager
DEF CHANNEL(QMCORD_TO_QMDEST) CHLTYPE(SDR) CONNAME('qmdstmc.mycomp.com(1416)') XMITQ(QMDEST) REPLACE
Define receiver channel for QMDEST queue manager
DEF CHANNEL(QMDEST_TO_QMCORD) CHLTYPE(RCVR) REPLACE
Close MQSC console
END
On machine 2 start MQSC console
runmqsc QMCSRC
Issue the following commands in MQSC console
Setup a dead letter queue for the queue manager.
ALTER QMGR DEADQ(SYSTEM.DEAD.LETTER.QUEUE)
Define a TCP listener
DEF LISTENER (TCP_LISTENER) TRPTYPE(TCP) CONTROL(QMGR) PORT(1415)
Start the listener
START LISTENER(TCP_LISTENER)
Define a transmit queue for use by sender channel to QMCORD queue manager
DEF QL(QMCORD) USAGE(XMITQ)
Define a sender channel to QMCORD queue manager. Remember to replace CONNAME with your values.
DEF CHANNEL(QMSRC_TO_QMCORD) CHLTYPE(SDR) CONNAME('qmcord.mycom.com(1414)') XMITQ(QMCORD) REPLACE
Define a receiver channel for QMCORD queue manager
DEF CHANNEL(QMCORD_TO_QMSRC) CHLTYPE(RCVR) REPLACE
Define Queue manager alias for QMDEST queue manager with communication routed through the QMCORD transmit queue.
DEFINE QR(QMDEST) RQMNAME(QMDEST) XMITQ(QMCORD) REPLACE
Close MQSC console
END
On machine 3 start MQSC console
runmqsc QMCDEST
Issue the following commands in MQSC console
Setup a dead letter queue for the queue manager.
ALTER QMGR DEADQ(SYSTEM.DEAD.LETTER.QUEUE)
Define a TCP listener
DEF LISTENER (TCP_LISTENER) TRPTYPE(TCP) CONTROL(QMGR) PORT(1416)
Start the listener
START LISTENER(TCP_LISTENER)
Define a transmit queue for use by sender channel to QMCORD queue manager
DEF QL(QMCORD) USAGE(XMITQ)
Define a sender channel to QMCORD queue manager. Remember to replace CONNAME with your values.
DEF CHANNEL(QMDEST_TO_QMCORD) CHLTYPE(SDR) CONNAME('qmcord.mycom.com(1414)') XMITQ(QMCORD) REPLACE
Define a receiver channel for QMCORD queue manager
DEF CHANNEL(QMCORD_TO_QMDEST) CHLTYPE(RCVR) REPLACE
Define Queue manager alias for QMSRC queue manager with communication routed through the QMCORD transmit queue.
DEFINE QR(QMSRC) RQMNAME(QMSRC) XMITQ(QMCORD) REPLACE
Close MQSC console
END
After completing the queue managers, start the channels to establish connection between the queue managers.
On machine 1 start MQSC console again
runmqsc QMCORD
and issue the following commands
START CHANNEL(QMCORD_TO_QMDEST)
START CHANNEL(QMCORD_TO_QMSRC)
Close MQSC console
END
On machine 2 start MQSC console again
runmqsc QMSRC
and issue the following commands
START CHANNEL(QMSRC_TO_QMCORD)
Close MQSC console
END
On machine 3 start MQSC console again
runmqsc QMDEST
and issue the following commands
START CHANNEL(QMDEST_TO_QMCORD)
Close MQSC console
END
This ends the IBM MQ Queue Manager network setup.
Now it's time to setup IBM MQ Managed File Transfer. As described above QMCORD
will be coordination queue manager and MQSRC
and QMDEST
will be agent queue managers as well as command queue managers.
Run the following command on machine 1
fteSetupCoordination -coordinationQMgr QMCORD -f
runmqsc QMCORD < C:\ProgramData\IBM\MQ\mqft\config\QMCORD\QMCORD.mqsc
The agent on machine 2 needs to know the coordination queue manager details. So run the following command to create required setup on machine 2.
fteSetupCoordination -coordinationQMgr QMCORD -f
Please note: As the required objects in coordination queue manager, QMCORD, have already been created on machine 1, there is no need to again run the mqsc file created in the above step against the coordination queue manager.
Setup the commands queue manager for agent. In this setup agent queue manager doubles up as commands queue manager.
fteSetupCommands -p QMCORD -connectionQMgr QMSRC -f
Create an agent, SRC_AGENT
on machine 2
fteCreateAgent -p QMCORD -agentName SRC_AGENT -agentQMgr QMSRC -f
runmqsc QMSRC < C:\ProgramData\IBM\MQ\mqft\config\QMCORD\agents\SRC_AGENT\SRC_AGENT_create.mqsc
Start the agent
fteStartAgent -p QMCORD SRC_AGENT
The agent on machine 3 needs to know the coordination queue manager details. So run the following command to create required setup on machine 3.
fteSetupCoordination -coordinationQMgr QMCORD -f
Setup the commands queue manager for agent. In this setup agent queue manager doubles up as commands queue manager.
fteSetupCommands -p QMCORD -connectionQMgr QMDEST -f
Create an agent, DEST_AGENT
on machine 3
fteCreateAgent -p QMCORD -agentName DEST_AGENT -agentQMgr QMDEST -f
runmqsc QMDEST < C:\ProgramData\IBM\MQ\mqft\config\QMCORD\agents\DEST_AGENT\DEST_AGENT_create.mqsc
Start the agent
fteStartAgent -p QMCORD DEST_AGENT
This ends the setting up of queue manager topology and agents.
Display the agent status.
fteStartAgent -p QMCORD DEST_AGENT
With all the setup done, now test the setup by initiating a file transfer. On machine 2, create a text file called sourcefile.txt
in c:\temp
directory and run the below command. Verify if the destfile
is created on machine 3.
fteCreateTransfer -sa SRC_AGENT -sm QMSRC -da DEST_AGENT -dm QMDEST -de overwrite -df "c:\temp\destfile.txt" "C:\temp\sourcefile.txt"