Skip to Content
Technical Articles

CPI SFTP sender – routing over filename

Introduction

In a CPI integration project, we had the challenge that we should use SFTP sender to pickup files, those should be routed differently based on the file name.

I will explain the found solution using a concrete example

We have 2 files on the same SFTP server in the same folder, these differ only in the name, for example test1.txt and test2.txt, these should be processed differently as mentioned above and have to be rooted to different SFTP server / folder

 

 

IFlow

 

Solution

We used the Router, so we have 2 processing variants, thus come to the important part of this blog.

To set the routing condition, 2 steps have to be implemented as shown in the picture below

Step1

  • Expression Type: have to be set to Non-XML

Step2

  • ${header.CamelFileName} = ‘test1.txt’

 

This have to be also implemented for the second routing, with the related  file name obviously.

 

More Information

The Expression Type drop-down list is important. It contains the values XML and Non-XML. The selected value influences the way the Condition field is interpreted by the execution engine during run time. If XML is chosen, the condition is interpreted as an XPath expression. If Non-XML is chosen, it is interpreted as an expression using Camel variables (among other things, this allows access to the variable headers).

 

To learn more about CPI Runtime Variables, feel free to follow the link

https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/d0fcb0988f034e889f611c6e36d43ad5.html

 

The Runtime Variables could also used with operators based on Apache Camel simple Language (check the point – OPERATOR SUPPORT)

 

 

I hope this blog post is useful

Youssef

Be the first to leave a comment
You must be Logged on to comment or reply to a post.