Install kafkajs and use Transport.KAFKA in createMicroservice() and ClientsModule.register(). Configure brokers, clientId, and consumer groupId. clientId identifies the application in Kafka logs; groupId determines which consumer group this instance belongs to — Kafka delivers each message to only one consumer per group.
clientId — identifies this application in Kafka logs and metrics; use a meaningful service name.
groupId — identifies the consumer group; Kafka delivers each message to one consumer per group.
brokers — array of broker addresses; provide multiple for high availability.
NestJS uses kafkajs internally — all kafkajs producer and consumer options are supported.
Each microservice instance with the same groupId competes for partition assignments — enabling horizontal scaling.
How would you set up a NestJS microservice to consume messages from a specific Kafka topic?
What configuration steps are required to connect a NestJS app to a Kafka broker?
If the microservice can’t establish a connection, which logs or error messages would you check first?
You need to add a new Kafka consumer to an existing NestJS service that already produces messages. How would you organize the module and why?
During testing you notice duplicate messages after the NestJS service restarts. What could be causing this and how would you resolve it?
If the Kafka broker address changes at runtime, how would you make your NestJS microservice adapt without redeploying?
Your system must handle 10 k messages per second across multiple partitions. How would you configure NestJS and Kafka to achieve high throughput and low latency?
Explain how you would implement a graceful shutdown for a NestJS Kafka microservice to avoid message loss.
What trade‑offs do you consider when choosing manual offset commits versus auto‑commit in a NestJS Kafka consumer?
Your organization is migrating from a legacy RabbitMQ event bus to Kafka, and many teams have NestJS services. How would you design a migration strategy that minimizes downtime and keeps both systems in sync?
Discuss how you would centralize Kafka client configuration across dozens of NestJS microservices to enforce consistency and support versioned schema evolution.
If you need to support multi‑region Kafka clusters with NestJS services, what architectural changes and operational concerns would you address?