Agenda - v6.0.0
    Preparing search index...

    Interface JobDefinition<DATA>

    interface JobDefinition<DATA = unknown> {
        backoff?: BackoffStrategy;
        concurrency?: number;
        filePath: string | undefined;
        fn: DefinitionProcessor<DATA, void | ((error?: Error) => void)>;
        lockLifetime: number;
        lockLimit: number;
        priority?: number;
    }

    Type Parameters

    • DATA = unknown
    Index

    Properties

    backoff?: BackoffStrategy

    Backoff strategy for automatic retries on failure. Can be a built-in strategy from backoffStrategies or a custom function.

    import { backoffStrategies } from 'agenda';

    // Using built-in exponential backoff
    agenda.define('myJob', handler, {
    backoff: backoffStrategies.exponential({ delay: 1000, maxRetries: 5 })
    });

    // Using a preset
    agenda.define('myJob', handler, {
    backoff: backoffStrategies.standard()
    });

    // Custom strategy
    agenda.define('myJob', handler, {
    backoff: (ctx) => ctx.attempt <= 3 ? 1000 * ctx.attempt : null
    });
    concurrency?: number

    how many jobs of this kind can run in parallel/simultanously per Agenda instance

    filePath: string | undefined
    fn: DefinitionProcessor<DATA, void | ((error?: Error) => void)>
    lockLifetime: number

    lock lifetime in milliseconds

    lockLimit: number

    max number of locked jobs of this kind

    priority?: number

    Higher priority jobs will run first.