SAP Cloud Integration: Generate Alert if file not found in Sender SFTP Folder
This document provides a way to leverage existing SAP Cloud Integration functionality to raise an alert when polling for a file from source SFTP Folder does not yield any results (Specified file does not exist in source folder).
To achieve this use case, we will use Poll Enrich pattern of SAP Cloud Integration.
To understand the functionality of Poll Enrich Pattern please click here.
Apart from the use cases illustrated in above blog post we can also use poll enrich to raise an exception in case no file is found in source SFTP folder.
To Achieve this:
- In the Processing tab of poll enrich select Aggregation Algorithm as Concatenate and Check the option Throw Exception if no Message Found.
Error Message received in Cloud Integration
org.apache.camel.CamelExchangeException: Error occurred during aggregation. Exchange[ID-5eb31a92-e4d2-46db-50e1-2fba-1642058552768-23-1]. Caused by: [org.apache.camel.RuntimeExchangeException - Polling with given parameters did not return any message.], cause: org.apache.camel.RuntimeExchangeException: Polling with given parameters did not return any message.
Doing this, whenever the specified file is not found in source directory, CPI iFlow fails in runtime and we can use this to catch exception using an Exception Sub Process and send an alert mail to the concerned team.
By using poll enrich only one file will poll per execution.
We have to poll multiple files from sender SFTP in one go, If files are not available in the server ,alert should be generated. Is there any workaround
If you are still looking for a solution and if these are specific set of files you can try below approach.
I am using poll enrich to send an alert notification whenever a file is not available in SFTP Server, it works fine for all the cases, for one case even if the file is available in the server I received an alert notification.
Please find below the error screenshot for your reference.