I am new to uber Cadence and trying to write a cron scheduled task. Cadence provided a cronSchedule annotation (find an example online) which takes a cron expression string for the method to be triggered at specific time. However, I want this cron expression to be loaded according to what we set in the yml file. Is there any way to do it? I currently only found this @cronSchedule annotation way to do it. I also found there is a WorkflowOption that I can set the cronSchedule. However, don't know how to use it to trigger the method. Below is the current code.
public interface CronTask {
@WorkflowMethod(
workflowId = CRON_WORKFLOW_ID,
taskList = TASK_LIST,
executionStartToCloseTimeoutSeconds = 30,
workflowIdReusePolicy = WorkflowIdReusePolicy.TerminateIfRunning
)
@CronSchedule("*/1 * * * *")
void kickOff(String name);
}
If there is no way to achieve this. Does anyone know if we can simply replace this @CronSchedule
annotation with spring @Scheduled
? Will the annotation WorkflowMethod
still work as expected?