Demo

Queue

ကိုယ်ပိုင် နောက်ခံအလုပ်များအတွက် BullMQ Queue instance များကို အသုံးပြုရပါသည်။ ပုံမှန်အချိန်ဇယားများအတွက်မူ CronJobService ကို အသုံးပြုရပါသည် (Cron job စာမျက်နှာကို ကြည့်ပါ)။

@Bean ဖြင့် queue မှတ်ပုံတင်ခြင်း

CronJobService အပြင် ကိုယ်ပိုင် queue လိုအပ်ပါက BullMQ Queue instance များကို DI container မှတဆင့် ထုတ်ပေးရပါသည်။ @Bean ဆိုင်ရာ စည်းကမ်း အပြည့်အစုံကို Bean annotations စာမျက်နှာတွင် ဖတ်ရှုနိုင်ပါသည်။

TSXservice
1import { Queue } from "bullmq"; 2import { Bean, Service } from "@quan-erp/shared-backend-core"; 3 4@Service() 5export class QueueRegistryService { 6 @Bean() 7 private registerQueue() { 8 return new Queue("my-queue", { connection: redisOptions }); 9 } 10}

အချိန်ဇယားအလုပ်များ

Cron အချိန်ဇယားများအတွက် builtin CronJobService (BullMQ + Redis + Postgres) ကို ဦးစားပေးရပါသည်။ Cron job စာမျက်နှာကို ကြည့်ရှုပါ။