Business Case:We had a requirement to send multiple files located in different directories from the Business System (FTP server) to target Business System (FTP system) and create files based on the payload.
Procedure:In order to achieve the above business case we need to process the multiple files at sender communication channel using file adapter. Sender file adapter has the option Advanced Selection for Source File. Check the option and maintain the list of directories from the source FTP server.
As per the above mentioned directories place the respective files in their folders. For Example sender folder holds the file out.xml file in the same way place the rest of the files in the sender1 and sender2 directories.
If you want to process all files with extension ‘.xml’, and want to exclude files that begin with the letter ‘a’. To do this enter *.xml for File Name, and a* for Exclusion Mask.
In file receiver communication channel to Create Multiple Files in the target system we are achieving this using Variable Substitution. In Advanced tab of the communication channel check the Enable under variable substitution, maintain variable name and corresponding reference of the variable. The variable can refer to an attribute of the message header or can refer to an element in the payload. However to create multiple files in the target system we are referring to the ‘Name’ element in the payload and using the prefix as payload. payload:MT_Employee,1,Employee,1,Details,1,Name,1
If we want to get the values from the Header message use prefix as message: instead of payload:. By using message:interface_namespace as a reference value to the variable.
For instance in above figure the variable ‘var1’ holds the reference of ‘Name’ element, which is use in the target filename schema for creating files in target system.