This example application is a follow up to How To Series - Part 1 of the developer blog. It illustrates how to poll for a CSV file, transform the data in the file into a different format as needed by the target, encrypt the data (secure), and transfer the file to a remote SFTP server.
This example polls for a folder, at an interval, and for a CSV file. The file contains fields such as SKU, Product Name, Description, and Type. The example transforms this input to a format as required by the B2B partner. Once the payload is transformed, it encrypts this payload using PGP encryption, and transfers this file to a SFTP server.
Set Up and Run the Example
Open the Example project in Anypoint Studio from AnypointExchange.
Install the Anypoint security module.
Create a Public key ring file and Secret key ring file along with a secret passphrase to be used for PGP encryption. Copy the two .gpg files into the src/main/resources folder.Details on how these files can be created can be found here.
Get the details for the target SFTP server to be used as the destination for the file.
Put all the details gathered in the above steps inside src/main/app/mule-app.properties.
Run the example application in Anypoint Studio or Standalone.
Transfer the sample.csv file inside the src/main/resources/archive folder into src/main/resources/input.
The file is picked up and transferred to the configured SFTP endpoint.