First-In, First-Out

The first type of jobs we are going to describe is the FIFO (First-In, First-Out) type. This is the standard type when adding jobs to a queue. The jobs are processed in the order they are inserted into the queue. This order is preserved independently on the amount of processors you have, however if you have more than one worker or concurrency larger than 1, even though the workers will start the jobs in order, they may be completed in a slightly different order, since some jobs may take more time to complete than others.

import { Queue }Β from 'bullmq'
const myQueue = new Queue('Paint');
// Add a job that will be processed before all others
await myQueue.add('wall', { color: 'pink' });

When you add jobs to the queue there are several options that you can use. For example you can specify how many jobs you want to keep when the jobs are completed or failed:

await myQueue.add(
{ color: 'pink' },
{ removeOnComplete: true, removeOnFailed: 1000 },

In the example above all completed jobs will be removed automatically and the last 1000 failed will be kept in the queue.