I am creating node bull queue and passing a dynamic name as an option to the Queue.add function
myQueue.add(`myJob-${val}`, {
attempts: 3,
removeOnFail: true
});
I am defining the process name as below for the above job
myQueue.process(`myJob-${val}`, async (job, callback) => {
try {
console.log('Processing job', job.id, job.data);
callback();
} catch (err) {
console.log(err);
}
});
However, I am getting below error
Job ID 1 failed Error: Missing process handler for job type myJob-123
How to correctly define the processor
with a dynamic name value?
The mistake you are making is passing extra fields in the add method.
Remove the name value from add method everything will work
only two parameters you have to pass while adding a job::--> data and options
A sample job handler file for your Ref:
};