Hi everyone,
I need to set a watched folder which will begin to scan the folder at 18PM and will stop at 8AM, even if there are still files to process.
I was hoping I could use the Repeat Count variable, (every 2 seconds for 1800 * 14 counts = 14 hours) but unfortunately the max value of Repeat Count is 100.
I did a little search, and it seems that the CRON expression doesn't allow this kind of demand.
Is there a way to do that ?
Can we ask a watched folder to start and stop working at a certain time ?
Kind regards,
Thomas
Solved! Go to Solution.
Views
Replies
Total Likes
I finally found how to do that by simply reading the CronTrigger doc !
Here's the link : http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html
My final CRON Expression is :
0/2 * 18-23,0-7 * * ?
Which means :
0/2 : every two seconds
* : every minutes
18-23,0-7 : from 6PM (18h) to 11PM (23h) and from 0AM to 8AM
* * ? : every day / every month / ...
Hope this helps !
I still have a question, Does this kind of configuration will consumn a lot of resource ?
Regards,
Thomas
Views
Replies
Total Likes
After a little more research, i may have found a solution :
CRON Expression : * 18-23,0-7 * * * -> Every minute between 18PM and 8AM.
Repeat Interval : 2 -> Every 2 seconds the folder is scanned
Repeat Count : 30 -> The folder is scanned 30 times (* 2s = 1 minute) at every cron expression.
I'll test that and let you know !
Views
Replies
Total Likes
Hi again,
This doesn't work because after reading the documentation, it is specified that the "Repeat Interval" is ignored if we use a CRON Expression ...
I really don't know what to do know, I hope someone has an answer !
Regards,
Thomas
Views
Replies
Total Likes
I finally found how to do that by simply reading the CronTrigger doc !
Here's the link : http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html
My final CRON Expression is :
0/2 * 18-23,0-7 * * ?
Which means :
0/2 : every two seconds
* : every minutes
18-23,0-7 : from 6PM (18h) to 11PM (23h) and from 0AM to 8AM
* * ? : every day / every month / ...
Hope this helps !
I still have a question, Does this kind of configuration will consumn a lot of resource ?
Regards,
Thomas
Views
Replies
Total Likes