The task run logic. It returns the output.
Behavior on throwing errors:
{@link DurableTaskError}
, the task will be marked as
failed{@link DurableTaskTimedOutError}
, it will be marked as timed out{@link DurableTaskCancelledError}
, it will be marked as cancelled
Options for a durable task that can be run using a durable executor. A task is resilient to task failures, process failures, network connectivity issues, and other transient errors. The task should be idempotent as it may be run multiple times if there is a process failure or if the task is retried.
When enqueued with an executor, a DurableTaskHandle is returned. It supports getting the execution status, waiting for the task to complete, and cancelling the task.
The output of the run function is the output of the task.
The input and output are serialized and deserialized using the serializer passed to the durable executor.
Make sure the id is unique among all the durable tasks in the same durable executor. If two tasks are registered with the same id, the second one will overwrite the first one, even if the first one is enqueued.
The tasks can be added to an executor using the DurableExecutor.task method. If the input to a task needs to be validated, it can be done using the DurableExecutor.validateInput or DurableExecutor.inputSchema methods.
See the task examples section for more details on creating tasks.