Skip to content

Instantly share code, notes, and snippets.

@benjaminudoh10
Created January 4, 2023 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminudoh10/a0d7abc71a450b2f9bf678854787df22 to your computer and use it in GitHub Desktop.
Save benjaminudoh10/a0d7abc71a450b2f9bf678854787df22 to your computer and use it in GitHub Desktop.
Bullqueue blog - Add processor
import { Job } from 'bullmq';
import { JobType, Queues } from '../enum/queue.enum';
import QueueService from '../services/queue.service';
// these enums should be in a separate file and exported
enum Queues {
DEFAULT = 'default',
}
enum JobType {
PROCESS_PAYMENT = 'process-payment',
}
export default class DefaultProcessor {
static async processPayment(job: Job) {
const queue = new QueueService().getQueue(Queues.DEFAULT);
if (!queue) return;
console.log(`Process job with id ${job.id} from the ${Queues.DEFAULT} queue`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment