0

I'm trying to get my microservice in one of my module

Microservice:

import { ServerKafka } from "@nestjs/microservices";
import { Admin } from "@nestjs/microservices/external/kafka.interface";

export class KafkaCustomTransport extends ServerKafka {
  get adminClient(): Admin {
    return this.client.admin();
  }
}

How I initialize it:

app.connectMicroservice({
  strategy: new KafkaCustomTransport(options)
});

Then in my service I would like to get access to it:

export class MyService {
  constructor(
    kafkaMicroservice: KafkaCustomTransport
  ) {
    
  }

Is there a way to achieve this?

0 Answers0