When running a workflow using setCronSchedule
, can I pass different values into it each time it runs? For example, run1
completes an activity at timeX
, and run2
needs to know the value of timeX
.
If not, will that be achievable using the Scheduled Actions feature, which appears to be available in the typescript-SDK 1.20? Is there an expected release date for that feature in the java-sdk?
Regardless to the answers above, is this sample the recommended way to achieve my goal? samples-java/HelloPeriodic.java at main · temporalio/samples-java · GitHub
If your cron execution returns a value you could get it out in the next cron run in workflow code via Workflow.getLastCompletionResult if you wanted.
Yes you could use periodic update and pass timeX as args to your continueAsNew stub as well.
It looks like getLastCompletionResult
will work! Some follow ups:
- Has this functionality been implemented? Cancelling cron scheduled workflow gracefully
- Is there a recommended way to test a cronSchedule’d workflow?
Thanks! And I just learned that if I run a workflow via the temporal schedule
command, getLastCompletionResult
works too!
1 Like