How to add a user defined message property for a file to message transfer.

Technote (troubleshooting)


Problem(Abstract)

You are doing message to file managed transfers using WebSphere MQ File Transfer Edition (WMQ FTE /WMQFTE) with WMQ V7.0 or using Managed File Transfer available in WMQ v7.5 and you want to include a user defined message property for the resulting message.

Resolving the problem

The easiest way to define a custom message property is using the -md flag on the transfer request; for example:

fteCreateTransfer -sa AGENT_JUPITER -da AGENT_SATURN -dq MY_QUEUE@MyQM
-qmp true -md account=123456 /tmp/source_file.txt

The above sends the file named /tmp/source_file.txt to the destination agent AGENT_SATURN and places the file as a message onto queue MY_QUEUE on queue manager MyQM. The message has a user defined property named usr.account in the MD with the value 123456. This is a property in the RFH2 header.

The above is documented WMQ Information Center:

Example: Setting user-defined properties on a file-to-message transfer

To do this via an Ant task, you can use the fte:filecopy or fte:filemove task to accomplish the same. An example fte:filecopy task would be:
<project xmlns:fte="antlib:com.ibm.wmqfte.ant.taskdefs" default="complete">
    <!-- Initialise the properties used in this script.
-->

  <target name="init" description="initialise task properties">
               <property name="src.file" value="/home/user/file1.bin"/>
               <property name="dst.queue" value="TEST.QUEUE@qm2"/>
               <fte:uuid property="job.name" length="8"
prefix="copyjob#"/>
       </target>
<target name="step1" depends="init" description="transfer file">

<fte:filecopy cmdqm="qm0@localhost@1414@SYSTEM.DEF.SVRCONN"
              src="agent1@qm1" dst="agent2@qm2"
             rcproperty="copy.result">

<fte:metadata>
<fte:entry name="fileName" value="${FileName}"/>
</fte:metadata>

<fte:filespec srcfilespec="${src.file}" dstqueue="${dst.queue}"
dstmsgprops="true"/>

</fte:filecopy>

</target>
</project>


To do the same with a resource monitor and variable substitution, here is an example transfer task XML:


<?xml version="1.0" encoding="UTF-8"?>
<monitor:monitor
xmlns:monitor=
"http://www.ibm.com/xmlns/wmqfte/7.0.1/MonitorDefinition"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" version="5.00"
xsi:schemaLocation=
"http://www.ibm.com/xmlns/wmqfte/7.0.1/MonitorDefinit ion ./Monitor.xsd">
 <name>METADATA</name>
 <pollInterval units="minutes">5</pollInterval>
 <batch maxSize="5"/>
 <agent>AGENT1</agent>
 <resources>
   <directory recursionLevel="0">e:\temp</directory>
 </resources>
 <triggerMatch>
   <conditions>
     <allOf>
       <condition>
         <fileMatch>
           <pattern>*.txt</pattern>
         </fileMatch>
       </condition>
     </allOf>
   </conditions>
 </triggerMatch>
 <tasks>
   <task>
     <name/>
     <transfer>
       <request version="5.00"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="FileTransfer.xsd">
         <managedTransfer>
           <originator>
             <hostName>slappyg.mqjason.raleigh.ibm.com.</hostName>
             <userID>administrator</userID>
           </originator>
           <sourceAgent QMgr="AGENTQM" agent="AGENT1"/>
           <destinationAgent QMgr="AGENTQM" agent="AGENT2"/>
           <transferSet priority="0">
             <metaDataSet>
               <metaData key="FileName">${FileName}</metaData>
             </metaDataSet>
             <item checksumMethod="MD5" mode="text">
               <source disposition="delete" recursive="false">
                 <file>${FilePath}</file>
               </source>
               <destination type="queue">
                 <queue persistent="true"
setMqProps="true">TEST.QUEUE@AGENTQM</queue>
               </destination>
             </item>
           </transferSet>
           <job>
             <name>Metadata_example</name>
           </job>
         </managedTransfer>
       </request>
     </transfer>
   </task>
 </tasks>
 <originator>
   <hostName>slappyg.mqjason.raleigh.ibm.com.</hostName>
   <userID>administrator</userID>
 </originator>
</monitor:monitor>

Product Alias/Synonym

WebSphere MQ File Transfer Edition WMQ FTE WMQFTE Managed File Transfer WMQMFT

Rate this page:

(0 users)Average rating

Document information


More support for:

WebSphere MQ
WMQ File Transfer Edition

Software version:

7.0.1, 7.0.2, 7.0.3, 7.0.4, 7.5

Operating system(s):

AIX, HP-UX, Linux, Solaris, Windows

Reference #:

1626281

Modified date:

2013-03-19

Translate my page

Machine Translation

Content navigation