I have a Nest.js microservice application. For message broker between MS I'm using kafka.
Now I want to inject this same connection inside health service to test it's state. I don't want to create a new client and new connection. I need the one which is created in main.ts.
const microserviceOptions = {
transport: Transport.KAFKA,
options: {
client: {
clientId: `id`,
brokers: [brokers],
},
consumer: {
groupId: 'group-id',
},
},
};
Ideally I would love to get kafkajs client directly from nestjs, to create producers and consumers.