StaticmakeMake a durable executor.
The storage to use for the durable executor.
The options for the durable executor.
Options available:
info.Add a task to the durable executor. See the task examples section for more details on creating tasks.
The task options. See TaskOptions for more details on the task options.
The task.
Add a sleeping task to the durable executor. See the task examples section for more details on creating sleeping tasks.
The task options. See SleepingTaskOptions for more details on the task options.
The sleeping task.
Add a parent task to the durable executor. See the task examples section for more details on creating parent tasks.
The parent task options. See ParentTaskOptions for more details on the parent task options.
The parent task.
Create a new task that runs a sequence of tasks sequentially. If any task fails, the entire sequence will be marked as failed.
The tasks list must be a list of tasks that are compatible with each other. The input of any task must be the same as the output of the previous task. The output of the last task will be the output of the sequential task.
The tasks list cannot be empty.
The tasks to run sequentially.
The sequential task.
Create a new task that runs a task until it returns { isDone: true, output: TOutput }. If
the task doesn't return { isDone: true, output: TOutput } within the max attempts, the
looping task will return { isSuccess: false }. Any error from the task will be considered a
failure of the looping task.
The id of the looping task.
The iteration task to run.
The maximum number of attempts to run the task.
OptionalsleepMsBeforeRun: number | ((attempt: number) => number)The sleep time before running the task. If a function is provided, it will be called with the attempt number. The initial attempt is 0, then 1, then 2, etc.
The looping task.
Add a validate input function to the durable executor.
The validate input function.
Add an input schema to the durable executor.
The input schema.
The input schema.
Enqueue a task for execution.
The task to enqueue, input, and options.
A handle to the task execution.
Get a handle to a task execution.
The task to get the handle for.
The id of the execution to get the handle for.
The handle to the task execution.
Wake up a sleeping task execution. The sleepingTaskUniqueId is the input passed to the
sleeping task when it was enqueued.
The task to wake up.
The unique id of the sleeping task to wake up.
The options to wake up the sleeping task execution.
The finished task execution.
Start the durable executor. Use DurableExecutor.shutdown to stop the durable executor.
Shutdown the durable executor. Cancels all active executions and stops the background processes and promises.
On shutdown, these happen in this order:
Get the running task executions count.
The running task executions count.
Get the running task execution ids.
The running task execution ids.
Get storage metrics for monitoring and debugging.
The storage metrics.
A durable executor. It is used to execute tasks durably, reliably and resiliently.
Multiple durable executors can share the same storage. In such a case, all the tasks should be present for all the durable executors. The work is distributed among the durable executors. See the usage and task examples sections for more details on creating and enqueuing tasks.
If using effect, use the
makeEffectDurableExecutorfunction to create the executor with first class support for effect. See makeEffectDurableExecutor for more details.Example