Setup Websphere MQ File Transfer Ant Script using Eclipse

Setup MQ File Transfer with Ant

Prerequistes confirm that an agent has been created and is running.

Step 1: Open Websphere MQ Explorer

Select Window à Preferences

Select the WebSphere MQ Explorer tab.

Select the radio button next to “in an Eclipse Workbench” under Startup. This will enable the WebSphere MQ Explorer to be used for other perspectives, such as Resource, Java, and the debug perspective.

Step 2: Now click on General Editors File Associations.

Step 3: Add New File Type

Press Default button


Press OK

Step 4: Change MQ Explorer Perspective -> Resource


Step 5: Modify Ant Runtime environment

Navigate to Windows -> Perference menu item

Expand the Ant folder.

Select the Runtime folder.

Select the Global Entries folder.

Press the Add External JAR’s… button.

Navigate to Navigate to *\WMQFTE\lib folder and add all the jars.

Step 6: Set Ant Home

(Follow on Step 5)Click the Ant Home button and navigate to *\WMQFTE\ant

Click OK to close the Preference window

Step 7: Import Ant Project

Select File->New->Other->Java Program from Exisiting Ant Build File

Step 8: Execute Ant File

<?xml version=’1.0′?>

<project xmlns:fte=”antlib:com.ibm.wmqfte.ant.taskdefs” name=”FTECOPY1″ default=”job” basedir=”.” >

<description> Simple FTE Transfer </description>

<!– set global properties for this FTE JOB –>

<target name=”init” description=”Set Global variables”>

<property name=”srcfile” value=”d:\Applications\disk1\File4.txt” />

<property name=”dstfile” value=”c:\File4.txt” />

<property name=”SNODE” value=”AGT1WIN@QM_AGENTHOST1″/>

<property name=”DNODE” value=”AGT1WIN@QM_AGENTHOST1″/>

<property name=”cmdqm” value=”QM_CMD1″/>

<property name=”jobName” value=”FTECOPY1″ />

<property name=”departId” value=”Demo” />

<fte:uuid length=”8″ property=”jobNumber” />

</target>

<target name=”step1″ depends=”init” description=”Transfer file”>

<fte:filecopy cmdqm=”${cmdqm}”

src=”${SNODE}” dst=”${DNODE}”

outcome=”await”

idproperty=”uuid.property_1″

jobname=”${jobName}”

rcproperty=”step1.result”>

<fte:metadata>

<fte:entry name=”departId” value=”${departId}” />

<fte:entry name=”jobNumber” value=”${jobNumber}” />

</fte:metadata>

<fte:filespec srcfilespec=”${srcfile}” dstfile=”${dstfile}” overwrite=”true”/>

</fte:filecopy>

</target>

<target name=”check1″ depends=”step1″ description=”Check return code and set variables”>

<condition property=”step1-failed”>

<not>

<equals arg1=”${step1.result}” arg2=”0″ />

</not>

</condition>

<fail if=”step1-failed”

message=”step1 transfer failed MAXRC=${step1.result}.”>

</fail>

<echo message=”The FTE  transfer has succeeded!” />

</target>

<target name=”job” depends=”init, step1,check1″ />

</project>

Step 9: Run Ant File

Right click on ant xml file and select Run As -> Ant Build

An sucessful transfer output:

MQAttach leverage the strengths of IBM WebSphere MQ/WMQ-FTE and the HTTP/S protocol

MQATTACH is a Licence FREE Windows-based solution built to extend IBM’s Managed File Transfer (MFT) capabilities to the desktop and beyond.

It is purpose built to leverage the strengths of IBM WebSphere MQ/WMQ-FTE and the HTTP/S protocol and extend these to desktop users in a simple, deployment friendly, cost effective and secure manner.

MQATTACH provides the following capability to end users from their desktops

  • Multiple views into WMQ/FTE’s Transfer History using Dashboards and with comprehensive Filtering/Drill-Down capablities.
  • Comprehensive administration functionality to define Companies, Departments, Send Groups and Users allowing for a central infrastructure with which to setup and manage end user and departmental MFT needs
  • Job “Centric” Detail to the WMQ/FTE Transfer History information allowing for easy and complete access to all transfer information including pre / post program output information
  • Windows GUI based “Mailbox” type file transfer mechanism supporting both internal and external desktop users facilitating HTTP/S file exchanges between users as well as between specially authorized users and WMQ/FTE Agents with full access control, security and transfer history tracking/logging capabilities.
  • A simple Command-Line Interface allowing users an alternate interface to the GUI for exchanging files.

Learn more about MQAttach or download the software please visit:

http://www.mqattach.com/