Use Case
In real-world integrations, especially with ERP or external systems, files received from source applications may vary in format — some may already be zipped while others may not. To ensure consistency and avoid errors during downstream processing or transfer to systems like SFTP, we need a way to check if a file is zipped and handle it accordingly.
This use case demonstrates an Oracle Integration Cloud (OIC) integration that intelligently detects whether an incoming file is a zipped archive. If the file is already zipped, it is forwarded directly to the target SFTP server. If it's not zipped, the integration compresses it and then transfers it to the target location.
Solution Steps
-
Scope:
CheckZipFile
- A scope that encapsulates the logic for file evaluation and error handling.
-
Main Flow:
- Stage File –
UnzipFile
:
Tries to unzip the incoming file.- If successful, it means the file was zipped. No further compression is needed.
- If it fails (i.e., the file isn't a zip), an exception is thrown.
- Stage File –
-
Fault Handler:
Default Handler
- Stage File –
ZipFile
:
This step is triggered only whenUnzipFile
fails, meaning the file wasn't zipped. The step compresses the incoming file. - Stitch –
AssignFileRef
:
Assigns or updates the file reference to point to the newly zipped version for further processing or transfer.
- Stage File –
-
Downstream Processing
- The processed (either original zipped or newly zipped) file is sent to the target SFTP or other endpoints.
Benefits
- Flexibility: Handles both zipped and non-zipped files without requiring format enforcement at the source.
- Error Handling: Robust fallback logic ensures no failure in case of unexpected file formats.
- Automation Ready: Ideal for file-based B2B integrations or scheduled ERP exports.
No comments:
Post a Comment