durable-execution - v0.32.0
    Preparing search index...

    Type Alias Task<TInput, TOutput, TTaskType>

    Represents a durable task that can be executed with automatic retry, timeout and failure handling capabilities.

    Tasks are the fundamental unit of work in the durable execution system. They encapsulate business logic that needs to run reliably despite failures.

    • id: Unique identifier for the task type
    • retryOptions: Configuration for automatic retry behavior
    • sleepMsBeforeRun: Optional delay before execution starts
    • timeoutMs: Maximum execution time before timeout
    const emailTask: Task<{to: string, subject: string}, {messageId: string}> = {
    id: 'sendEmail',
    retryOptions: { maxAttempts: 3, baseDelayMs: 1000 },
    sleepMsBeforeRun: 0,
    timeoutMs: 30000
    }

    See the task examples for more patterns and use cases.

    type Task<TInput, TOutput, TTaskType extends TaskType = TaskType> = {
        taskType: TTaskType;
        id: string;
        retryOptions: TaskRetryOptions;
        sleepMsBeforeRun: number;
        timeoutMs: number;
    }

    Type Parameters

    • TInput
    • TOutput
    • TTaskType extends TaskType = TaskType
    Index

    Properties

    taskType: TTaskType
    id: string
    retryOptions: TaskRetryOptions
    sleepMsBeforeRun: number
    timeoutMs: number