I'm using the Kafka JS to connect to kafka. In my consumer, initially I named my group id as 'orderable-test', later when I updated the this group id to 'orderable-test-1' and rerun my code, the group id remains the 'orderable-test'. Even if I comment out this consumer completely and write another consumer with a different group id in a different file, it still give me this 'orderable-test' as the group id instead of the new one. I would like to know what's the cause of it and how can I solve this.
Below is the code sample I wrote.
const consumer = kafka.consumer({ groupId: 'order-create-test' });
export class OrderInfoController {
constructor(private readonly OrderInfoService: OrderInfoService) {}
async onModuleInit() {
await consumer.connect();
this.CreateOrderConsumer(consumer);
}
async onModuleDestroy() {
await consumer.disconnect();
}
async CreateOrderConsumer(consumer){
await consumer.subscribe({ topic: 'test-order', fromBeginning: true });
await consumer.run({
eachMessage: async ({ topic, partition, message }) => {
console.log({
topic, partition,
message:{
key: message.key.toString(),
value: message.value.toString(),
}})
},
});
}