Search This Blog

Tuesday, August 6, 2019

How to Skip the Job Execution If No Files are Present to Process in a Folder

Skipping Job Execution if there are Zero files to process is very common business requirement.
Job should not trigger if there are no files present at source location.
There are many ways to handle this scenario.
There are 2 ways to trigger the Talend job
1. Run .sh file using cron
2. Trigger Talend job through TAC

If you are running Talend Job with cron command then you can simply handle the Job Execution at shell scripting level by checking if files are present in particular folder or not.
But if you are using TAC then you will have to handle this scenario at Job Level.

Below are the steps :
1. Use tFileList component & give the source folder to pick the files
2. Connect the Run If trigger gain to tFileList component giving condition : "tFileList_2_NB_FILE" >0
3. Continue with second tFileList for rest ETL logic

Job to Iterate Source folder & Print File Names


IF Condition to Skip Job Execution If Zero Files Exists