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:

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s