Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

File polling till specific time

Hi All,

I have a requirement for polling a directory for files and I am using tWaitforFile Components but facing one issue. Actually tWaitforFile provides option for seconds between iterations and no of iterations to exit out of infinite loop but I want to do file polling till specific time, suppose if job starts at 8 then till 10 I need to do file polling. 

 

If would be great if anyone worked on the same scenario and share their approach.

 

Labels (2)
2 Replies
David_Beaty
Specialist
Specialist

Hi,

 

In this scenario, you could use the tLoop component, tFileExists & tSleep.

 

However generally, I wouldn't recommend a Talend start and stay running, looping for an indefinite period of time - could you not just trigger the job to run every few minutes externally (from CRON or something) between 8 & 10?

 

vapukov
Master II
Master II

as variant - combination

 

tLopp + tSleep + compare time from start:

 

0683p000009M23y.png

 

at the begin in tJava save StartTime:

context.StartTime=TalendDate.getCurrentDate();

and compare it with current time for each iteration:

TalendDate.compareDate(TalendDate.getCurrentDate(),TalendDate.addDate(context.StartTime,2,"HH")) <=0

similar logic could be about absolute time

 

and also you can add in tLoop criteria && additional parameter - is FileReceived and put this to 1 for exit loop earlier