Every job can have its own custom data. The data is stored in the data
attribute of the job:
import { Queue } from 'bullmq';
const myQueue = new Queue('paint');
const job = await myQueue.add('wall', { color: 'red' });
job.data; // { color: 'red' }
from bullmq import Queue
queue = Queue('paint')
job = await queue.add('wall', {'color': 'red'})
job.data # { color: 'red' }
Update data
If you want to change the data after inserting a job, just use the updateData
method. For example:
const job = await Job.create(queue, 'wall', { color: 'red' });
await job.updateData({
color: 'blue',
});
job.data; // { color: 'blue' }
from bullmq import Queue
queue = Queue('paint')
job = await queue.add('wall', {'color': 'red'})
await job.updateData({'color': 'blue'})
job.data # { color: 'blue' }
Read more:
Last updated