Open tillrohrmann opened 2 years ago
Related to https://github.com/restatedev/restate/issues/844 as well.
We got some user feedback about this.
Current proposal of the semantics for a first version:
crontab
, used in a couple of projects such as Spring and Quartz.@Scheduled(cron = "10 * * * * *")
. The registration of crons is static and associated with the event of registering/updating a service.@Scheduled
annotation. Virtual objects and Workflows handlers cannot use it (for now).An extension of this proposal is to have an Admin API/CLI command or perhaps even Context
API where crons can be dynamically created/removed, but perhaps we can do that once we get user feedback that this is effectively needed.
This would be extremely useful.
The use case where we emulated scheduled services by implementing a recursive delayed object_send
in a VirtualObject
was pretty much as follows:
self
with a 10 second delaySlight difference here would be that the service would make a call to a VirtualObject
holding the last processed state, but overall the flow could be easily implemented without the recursion hack.
Big fan of that feature! It would essentially enable Restate to sense (by polling) external systems that might not have the ability to push.
We are moving our BPMN execution engine over to restate. BPMN start events can be timer type start events and are configured using the ISO8601 repeating interval standard. https://en.wikipedia.org/wiki/ISO_8601#Repeating_intervals
Each time the timer triggers, it will call a service which will begin the execution of the BPMN process
My use case would be a static cron, not dynamic on application events, to start a business process at the same time on the same weekday each week, e.g. 12:00 Monday
I will (future) need to be able to start the same business process at different times with different inputs, e.g. 12:00 Monday with ABC input and 13:00 Monday with DEF input. I see inputs are out of scope for current proposal, of course it's possible to define a dedicated handler for each to invoke the main handler with the desired input in the meantime. This in my case won't need to scale up to loads of different inputs
I would also like to be able to "stop" the business process from running some days on demand, and turn it back on again, dynamic to application events, but for this I'd probably want to just have a virtual object with some boolean state that acts as that decision gate, which the cron-invoked handler would first check before continuing. I would still expect the cron to receive a success response from the handler so it doesn't retry. Again, I don't believe anything in this paragraph needs anything specific built to support it, just context for you
Something worth considering: Are cron expressions going to be UTC, or will it be possible to specify a timezone location, e.g. "London" that auto switches between UTC+0 (GMT) and UTC+1 (BST)
It might be useful to be able to periodically invoke a function. The way such a cron function would be invoked is by an interval that is configured by the user.