Processing files using Multiple File Name Patterns in OIC FTP Adapter
Use Case
We have a requirement in Oracle Integration Cloud (OIC) to poll two different files with specific naming patterns from an FTP or file system. The files have different prefixes but share a common date pattern (YYYYMMDD
). The integration should only process the files when both exist. If one of the files is missing, the integration should throw a fault and exit.
Example File Name Patterns:
- File 1:
abc_YYYYMMDD*
- File 2:
XYZ_YYYYMMDD*
- File Polling Pattern:
abc_YYYYMMDD*|XYZ_YYYYMMDD*
Solution Approach
Step 1: Configure File Adapter to list for Both File Patterns
- We have used a lookup and put the file name pattern as abc_YYYYMMDD*|XYZ_YYYYMMDD*
- configure the ftp adapter with list operation and map the file name pattern from the lookup. We are also replacing the YYYYMMDD with a fileProcessing date.
- This configuration ensures the adapter picks up files matching either of the patterns.
Step 2: Handle Missing Files with a throw New Fault action
- If either
file1Count
orfile2Count
is0
, use a Throw New Fault action: throw new Fault("Both files are required for processing, but one or more are missing.") - This ensures that the integration stops if any of the required files are missing.
- Add the following logic in the Skip Condition to ensure processing only when both files are present:
file1Count > 0 AND file2Count > 0
.
Detailed screenshots:
FTP list mapping:
Throw New Fault
No comments:
Post a Comment