Created
January 4, 2023 11:02
-
-
Save benjaminudoh10/a0d7abc71a450b2f9bf678854787df22 to your computer and use it in GitHub Desktop.
Bullqueue blog - Add processor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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