0
0
NestJSframework~10 mins

Named jobs in NestJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a named job in a NestJS Bull queue.

NestJS
this.queue.add('[1]', { data: payload });
Drag options to blanks, or click blank then click option'
Adefault
BsendEmail
Cjob
Dprocess
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'process' as job name which is a method name, not a job name.
Omitting the job name string.
2fill in blank
medium

Complete the code to process a named job in a NestJS Bull processor.

NestJS
@Processor('email')
export class EmailProcessor {
  @Process('[1]')
  handleSendEmail(job: Job) {
    // handle job
  }
}
Drag options to blanks, or click blank then click option'
Adefault
BemailJob
Cprocess
DsendEmail
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different job name than the one used when adding the job.
Using method names instead of job names in the decorator.
3fill in blank
hard

Fix the error in the code to correctly add a named job with options.

NestJS
this.queue.add([1], payload, { repeat: { cron: '0 0 * * *' } });
Drag options to blanks, or click blank then click option'
A'sendEmail'
BsendEmail
C'process'
Dprocess
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put quotes around the job name string.
Using variable names instead of string literals.
4fill in blank
hard

Fill both blanks to define and process a named job in NestJS Bull.

NestJS
this.queue.add('[1]', { userId: 123 });

@Processor('notifications')
export class NotificationProcessor {
  @Process('[2]')
  handleNotification(job: Job) {
    // process notification
  }
}
Drag options to blanks, or click blank then click option'
AsendNotification
BsendEmail
Attempts:
3 left
💡 Hint
Common Mistakes
Using different job names for adding and processing.
Mixing job names like 'sendEmail' and 'sendNotification'.
5fill in blank
hard

Fill all three blanks to add a named job with options and process it in NestJS Bull.

NestJS
this.queue.add('[1]', { orderId: 456 }, { delay: [2] });

@Processor('orders')
export class OrderProcessor {
  @Process('[3]')
  handleOrder(job: Job) {
    // process order
  }
}
Drag options to blanks, or click blank then click option'
AprocessOrder
B5000
DsendOrder
Attempts:
3 left
💡 Hint
Common Mistakes
Using different job names in add and process.
Putting delay as a string instead of a number.
Omitting the delay option.