PollingJobQueueStrategy
PollingJobQueueStrategy
This class allows easier implementation of JobQueueStrategy in a polling style.
Instead of providing JobQueueStrategy start() you should provide a next method.
This class should be extended by any strategy which does not support a push-based system to notify on new jobs. It is used by the SqlJobQueueStrategy and InMemoryJobQueueStrategy.
Signature
class PollingJobQueueStrategy extends InjectableJobQueueStrategy {
    public concurrency: number;
    public pollInterval: number | ((queueName: string) => number);
    public setRetries: (queueName: string, job: Job) => number;
    public backOffStrategy?: BackoffStrategy;
    public gracefulShutdownTimeout: number;
    protected activeQueues = new QueueNameProcessStorage<ActiveQueue<any>>();
    constructor(config?: PollingJobQueueStrategyConfig)
    constructor(concurrency?: number, pollInterval?: number)
    constructor(concurrencyOrConfig?: number | PollingJobQueueStrategyConfig, maybePollInterval?: number)
    start(queueName: string, process: (job: Job<Data>) => Promise<any>) => ;
    stop(queueName: string, process: (job: Job<Data>) => Promise<any>) => ;
    cancelJob(jobId: ID) => Promise<Job | undefined>;
    next(queueName: string) => Promise<Job | undefined>;
    update(job: Job) => Promise<void>;
    findOne(id: ID) => Promise<Job | undefined>;
}
- Extends: InjectableJobQueueStrategy
concurrency
property
numberpollInterval
property
number | ((queueName: string) => number)setRetries
property
(queueName: string, job: Job) => numberbackOffStrategy
property
gracefulShutdownTimeout
property
numberactiveQueues
property
constructor
method
(config?: PollingJobQueueStrategyConfig) => PollingJobQueueStrategyconstructor
method
(concurrency?: number, pollInterval?: number) => PollingJobQueueStrategyconstructor
method
(concurrencyOrConfig?: number | PollingJobQueueStrategyConfig, maybePollInterval?: number) => PollingJobQueueStrategystart
method
(queueName: string, process: (job: Job<Data>) => Promise<any>) => stop
method
(queueName: string, process: (job: Job<Data>) => Promise<any>) => cancelJob
next
method
(queueName: string) => Promise<Job | undefined>Should return the next job in the given queue. The implementation is responsible for returning the correct job according to the time of creation.
update
method
(job: Job) => Promise<void>Update the job details in the store.
findOne
Returns a job by its id.