ProcessorContext.schedule(..)
accepts duration interval parameter, and we could specify that some action (punctuator) will be executed every X time interval (e.g. every hour). With such scheduling, execution time depends on the last application restart time. And additionally, if we have multiple instances of application, and only app on single node was restarted (e.g. due to some prod issue), punctuators will be executed at absolutely different times on each node. For some use cases it might be not applicable, and it's needed to execute punctuator by cron expression, like with "0 0 * * * ?"
execute every hour, approximately at time XX:00:00
.
Is it possible to schedule punctuator by cron expression? or does exist any workaround?
As a dirty workaround, we could calculate time interval from now till upcoming first execution of cron inside Processor.init(..)
, and on first triggering of punctuator, cancel existing scheduling and create a new one, converting from cron expression to duration instance. seems such workaround is error prone.