Delay and Schedule Workflows
Corteza workflow allows you to schedule or delay its execution. This can be a powerful tool when working with external services that throttle their API usage or when a task should be performed in an interval, for example monthly subscription renewal.
To achieve this, you are provided with a delay step and a deferred trigger .
The delay of execution
The delay step allows you to explicitly pause the workflow’s execution for a set period of time.
This type of delaying is common when working with APIs that throttle their access. To exemplify; let’s say that the API allows 10 calls per minute and we wish to fetch 100 items. A possible execution is as it follows:
In case you wish to wait for an action performed by a user (such as a confirmation), use a prompt step instead. |
Execution scheduling
Execution scheduling is performed by configuring the trigger to run in an interval or at a specific timestamp.
An interval trigger allows you to run the workflow in a specified interval. This can be used to perform routine daily tasks or process larger data in batches. A good example is a subscription service where it is necessary to renew the subscriptions of the clients on a monthly basis. We define an interval that executes the workflow each day, determine what clients need to be renewed that day and renew them.
To define an interval trigger, click on the click on the configuration icon and specify the system as the resource resource with the on interval event. The interval is defined as a chron expression and can be extremely flexible. You can also use this amazing tool to verify that your expressions are valid. Common cron examples:
|
|||||
A timestamped trigger allows you to run the workflow at a specified time. To illustrate; you have just received a new client that requested a series of deadlines where they would like to see the current progress. We could define a scheduled workflow that is executed at each one of the timestamps. The workflow would aggregate all of the completed tickets into an email and send it off to the client. Timestamps are defined in the ISO 8601,
|
Execution timeout
Corteza workflows' execution does not timeout by default (the workflow can run indefinitely).
If your use-case requires you to define a timeout, you can implement this manually.
-
Schedule a timeout after 10sec of execution,
-
repeat the iterator indefinitely.