We are starting to use Temporal’s Scheduled Workflows a lot more. (We used to use cron workflows in the past.) In one of the use cases, the schedule will be provided by users, i.e. users can decide to run certain workflows either once immediately, once at a specified time in the future, or on a specified interval.
I’ve got a couple of questions related to this:
- The docs mention that it’s possible to limit the number of actions executed by a schedule:
A Schedule can be limited to a certain number of scheduled Actions (that is, not trigger immediately). After that it will act as if it were paused.
But it’s not clear from the ScheduleSpec how to actually do that. What am I missing?
-
Is there some way to verify a schedule/calendar spec first before we actually go ahead and schedule the workflow? The docs for the ScheduleSpec#encode method refer to a verify method, but that doesn’t seem to exist. (Or is not exposed.)
-
What’s the best way to specify a schedule that should run once at a specified time in the future? The only way we could see is to use a calendar-based schedule, e.g.
{ calendar: [{ year: 2023, month: 'NOVEMBER', dayOfMonth: 31, hour: 8 }] }
. But we would like to be able to tell whether a schedule will run exactly once or more than once, and this form makes that a bit difficult, unless we implement our own parsing logic for the CalendarSpec. (Not too difficult, just wondering if there is an easier/better way.)