Poll new file from SFTP location

 

Let’s see how we can poll a new file from SFTP location

Create a project in Anypoint Studio

Add On New or Updated file activity

Polling new file from SFTP location

 

Add the logger to print incoming filename

Polling new file from SFTP location

 

Add a logger to print file payload

 

Configure the SFTP connection

 

Provide the SFTP details and test the connection

  • Working directory – directory within the root directory
  • Host name – SFTP machine IP
  • Port – SFTP machine port
  • Username and password to authenticate the user

 

Configure the On New or Updated File activity

 

Key Configurations

  • Auto Delete – to delete the polled file
  • Move to directory – archiving the polled file to another directory
  • Rename to – renaming the polled file
  • Scheduling Strategy – this is quite import to make it real time or as n when required. If files are created at particular time then we can schedule it properly
  • Matcher – filtering the incoming file based on matcher condition
  • Directory – directory under working directory (define in SFTP configuration above) we want to poll
  • Recursive – if we want to poll sub directories as well
  • Watermark – hold the last execution details and poll the new files only which are created after the last execution

 

Once configured we can run the application and create a new file in SFTP location

Polling new file from SFTP location

 

We can see the logs in mule application

Polling new file from SFTP location

 

Sample Application – sftp-service

 

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments