Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
tripathi_sachin
Explorer
Hello Integration Folks,

In this blog post you will be knowing how to route files based on filenames.

Business Case: I had a requirement in my project to poll the files with different filenames from the same SFTP directory server via CPI and send it to 3rd party SFTP server.

Solution: 

Use router to route incoming files based on the filenames. For ex., SalesOrder2021_05_18T051632.csv , ScheduleOrder2021_05_18T041812, etc.

1. Create your iflow and configure your sender SFTP.

2. Connect Router in order to route the files.


 

3. Select expression type as Non-XML and provide conditions as :

${header.CamelFileName} regex 'SalesOrder.*' for first router

${header.CamelFileName} regex 'ScheduledOrder.*' for second router

and keep last router as default route.

-> ${header.CamelFileName} regex 'x.*' means it will route all the messages that have a filename starting with x.




For more information on usage of non-xml conditions, click here.

Conclusion: You will now be able to route incoming files to different routes based on filename and can perform modifications/ transformations as required.

I am new to CPI, please keep supporting and suggest improvements.

Happy learning !!!

Thanks & regards,

tripathi.sachin
2 Comments
Labels in this area