diff --git a/src/kafka/kafka.service.ts b/src/kafka/kafka.service.ts index d29c3d1..1e522db 100644 --- a/src/kafka/kafka.service.ts +++ b/src/kafka/kafka.service.ts @@ -33,10 +33,10 @@ export class KafkaService implements OnApplicationBootstrap, OnModuleDestroy { this.consumer = this.kafka.consumer({ groupId: process.env.CONSUMER_GROUP, }); - this.consumer.connect(); } async onApplicationBootstrap() { + await this.consumer.connect(); await this.consumer.subscribe({ topic: this.topic, fromBeginning: false }); await this.consumer .run({