Simple File Transfer using MQ File Mover (How To #1)

I get asked on a regular basis how to do a simple MQ File Mover (MQFM) setup on 2 servers. It is actually very straight forward and I will run through an example in this blog posting.


In this example, the following servers are used:
– aix001 is an AIX server with WMQ Server and MQFM software installed
– linux001 is a Linux server with WMQ Server and MQFM software installed

In this example, the following queue managers are used:
MQA1 is a queue manager residing on a AIX (aix001) server (sender)
MQL1 is a queue manager residing on a Linux (linux001) server (receiver)

TEST.LINUX.QL and TEST.LINUX.QL.BK are local queues defined in queue manager MQL1 (receiver)
TEST.LINUX.QR is a remote queue defined in queue manager MQA1 (sender)

If you do not know how to define/setup communication between 2 queue managers then follow the instructions in this blog posting:
http://www.capitalware.biz/rl_blog/?p=509

Step #1: On the Linux server, in the MQFM install directory, create a file called mqfm_receive_test_1.xml and copy the following into the file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE MQFM_Workflow SYSTEM "MQFM_Workflow.dtd">
<MQFM_Workflow>

  <Actions>
    <Receive getwithconvert="Y" run="D">
      <MQ>
        <QMgrName>MQL1</QMgrName>
        <QueueName>TEST.LINUX.QL</QueueName>
        <BackOutQName>TEST.LINUX.QL.BK</BackOutQName>
      </MQ>
      <Default>
         <Directory override="Y">/home/roger/MQFM/</Directory>
      </Default>
    </Receive>
  </Actions>

</MQFM_Workflow>

When MQFM is started, it will run as a daemon (run=”D”) and use a backout queue called TEST.LINUX.QL.BK just in case there is an issue with a message. MQFM will use ‘get with convert’ option when retrieving the messages. MQFM will override the message’s specified directory and use the one provided. Either create /home/roger/MQFM/ directory on your Linux server or use a directory that already exist on your Linux server.

Step #2: On the Linux server, start MQFM to receive the file transfers:

./mqfm.sh mqfm_receive_test_1.xml &

Step #3: On the AIX server, create a file in the data directory called test.txt and put a simple text message in the file (i.e. This is a test message.)

Step #4: On the AIX server, in the MQFM install directory, create a file called mqfm_send_test_1.xml and copy the following into the file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE MQFM_Workflow SYSTEM "MQFM_Workflow.dtd">
<MQFM_Workflow>

  <Actions>
    <Send delete="N" format="S">
      <File>data/test.txt</File>
      <MQ>
        <QMgrName>MQA1</QMgrName>
        <QueueName>TEST.LINUX.QR</QueueName>
      </MQ>
      <Remote>
        <Directory>/var/mqm/</Directory>
      </Remote>
    </Send>
  </Actions>

</MQFM_Workflow>

When MQFM is started, it will send the specified file and mark the message’s MQMD format as ‘string’.

Step #5: On the AIX server, start MQFM to send the file:

./mqfm.sh mqfm_send_test_1.xml

MQFM will start and put the file as a message to the specified queue then terminate.

Step #6: On the Linux server, verify that the test file (i.e. test.txt) was put into the /home/roger/MQFM/ directory or whatever directory you specified in the mqfm_receive_test_1.xml file.

Step #7: Finally, we need to stop MQFM daemon that is running on the Linux server. In the MQFM install directory, create a file called mqfm_putquit_test_1.xml and copy the following into the file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE MQFM_Workflow SYSTEM "MQFM_Workflow.dtd">
<MQFM_Workflow>
  <Actions>
    <PutQuit>
      <MQ>
        <QMgrName>MQL1</QMgrName>
        <QueueName>TEST.Q1.QL</QueueName>
      </MQ>
    </PutQuit>
  </Actions>
</MQFM_Workflow>

Step #8: On the Linux server, run MQFM with the PutQuit action:

./mqfm.sh mqfm_putquit_test_1.xml

Hopefully, that will help new users of MQFM to get up and running in minutes. In the future, I will post more complex MQFM examples.

Regards,
Roger Lacroix
Capitalware Inc.

This entry was posted in Capitalware, IBM i (OS/400), IBM MQ, Java, Linux, macOS (Mac OS X), MQ File Mover, Open Source, Unix, Windows.

Comments are closed.