Hi Experts,
I have pass-through SFTP to SFTP scenario where I have to dynamically archive the PDF files based on the file name and in case the folder does not exist then I have to create one. I have thought of two solutions but I do not have the sandbox to try them out. I am mentioning below the two scenarios and any queries related to it. Kindly provide us with your opinion and feedback -
1. Two Interfaces Solution: In this, I will first create an interface that will pick the PDF file from source directory and place it in a temporary folder in the target. The second interface will pick PDF files from the temporary directory and using ASMA and UDF will create a dynamic target directory to place the files in the actual archive directory. My confusion here is that, since it is a pass-through scenario whether creating a dummy Data Type, Message Type, Service Interface, Message Mapping and Operation Mapping for the second interface will work or not (as I need to write a UDF to define the target directory).
2. Java Program/Script: I will create the pass-through interface and will call the java program/script from "Run OS command after file processing" but my challenge is that I have limited knowledge on scripting and I have never done this before. It will be helpful if someone can outline the steps on how to write the code, where to place the java code and how to call it from the receiver SFTP channel.
Regards,
Arkesh
Arkesh,
can you please explain how directory name and filename are related ?
Lets say your fileName is :
ABC.pdf then folder would be /Test/ABC
XYZ.pdf then folder would be /Test/XYZ
if above is the case then you can create dynamic directory by using DynamicConfiguration module + variable substitution.
And yes as above you have mentioned the pdf will miss for the first approach because before mapping the pdf will be the mainpayload but in mapping as you are using Dynamic UDF so the main payload will be your dummy message type .
alternatively you can use java mapping to assign Dynamic Folder and also make the output as the pdf itself.
Br,
Manoj
Hi Arkesh,
The easiest solution is the first option which is creating two interfaces.
First interface is for the main scenario (Source to Target Folder) and second interface is for your dynamic archiving. And use a receiver split with different operation mapping so you only have to pick the source file once.
Best regards,
Marc
Add a comment