Hello everyone, I'm new to this Discord.
I have a quick question about modules. Is this a good practice to start my consumer here ?
@Module({
imports: [ContactModule],
controllers: [SchedulerController],
providers: [
SchedulerService,
{
provide: 'SqsSchedulerConsumer',
useFactory: (schedulerService: SchedulerService) => {
const consumer = new SqsSchedulerConsumer(schedulerService);
consumer.start(); // Here <<<<<<
return consumer;
},
},
],
exports: [],
})
export class SchedulerModule {}
I tried using OnApplicationBootstrap implementation in my SqsSchedulerConsumer class, but it never gets triggered at startup.
What is the best way to inject and start my SQS consumer ?
Thank you for your help !