🚨 Announcing Vendure v2 Beta

JobQueueStrategy

JobQueueStrategy

Defines how the jobs in the JobQueueService are persisted and accessed. Custom strategies can be defined to make use of external services such as Redis.

Signature

interface JobQueueStrategy extends InjectableStrategy {
  add<Data extends JobData<Data> = {}>(job: Job<Data>): Promise<Job<Data>>;
  start<Data extends JobData<Data> = {}>(
        queueName: string,
        process: (job: Job<Data>) => Promise<any>,
    ): Promise<void>;
  stop<Data extends JobData<Data> = {}>(
        queueName: string,
        process: (job: Job<Data>) => Promise<any>,
    ): Promise<void>;
}

Extends

Members

add

method
type:
(job: Job<Data>) => Promise<Job<Data>>
Add a new job to the queue.

start

method
type:
(queueName: string, process: (job: Job<Data>) => Promise<any>) => Promise<void>
Start the job queue

stop

method
type:
(queueName: string, process: (job: Job<Data>) => Promise<any>) => Promise<void>
Stops a queue from running. Its not guaranteed to stop immediately.