Questions
6 of 25
1What is the difference between request-response and event-based (fire-and-forget) message patterns in NestJS microservices?
2What is the @Payload() decorator and how do you use @Ctx() to access transport-specific context in NestJS microservices?
3How do you connect a NestJS microservice to RabbitMQ?
4How do you implement manual message acknowledgement with RabbitMQ in NestJS?
5How do you implement a RabbitMQ topic exchange for routing messages to multiple queues based on routing keys in NestJS?
6How does gRPC differ from REST and when would you choose it for inter-service communication in NestJS?
7How do you implement an API Gateway pattern in NestJS that aggregates multiple microservices?
8How do you implement distributed tracing across NestJS microservices?
9What transport layers does NestJS support for microservices and how do you bootstrap a microservice?
10How do you connect a NestJS microservice to Apache Kafka?
11How do you handle Kafka message patterns and access message headers and partition info via KafkaContext in NestJS?
12How do you set up gRPC in a NestJS microservice?
13How do you implement a circuit breaker pattern when calling a downstream microservice in NestJS?
14How do you inject and use a ClientProxy to communicate with another microservice in NestJS?
15How do you handle errors in microservice request-response patterns and propagate them to the caller in NestJS?
16How do you implement Kafka consumer groups and what guarantees does partition assignment give you in NestJS?
17How do you implement the outbox pattern with Kafka in NestJS to guarantee exactly-once message delivery?
18How do you implement gRPC streaming including server-side, client-side, and bidirectional streaming in NestJS?
19What is the difference between @EventPattern() and @MessagePattern() in NestJS microservices?
20How do you implement the Saga pattern for distributed transactions across NestJS microservices?
21How do you implement idempotent event handlers to safely handle duplicate message delivery in NestJS?
22How do you implement event sourcing with NestJS microservices?
23How do you implement retry logic with exponential backoff for failed microservice calls in NestJS?
24How do you test a NestJS microservice controller in isolation without a real message broker?
25How do you implement service discovery and load balancing across NestJS microservice instances?
06 / 25

How does gRPC differ from REST and when would you choose it for inter-service communication in NestJS?

gRPC uses HTTP/2 with binary Protobuf encoding — payloads are typically 3-10x smaller and faster to parse than JSON. The .proto file is the single source of truth for the API contract, eliminating documentation drift. gRPC supports native streaming. Choose gRPC for high-throughput internal service calls; choose REST for public-facing APIs.

gRPC is a contract-first RPC framework using Protobuf over HTTP/2. It excels at high-frequency internal service communication where performance and type safety matter. REST remains the better choice for public APIs that browser and mobile clients consume directly.

gRPC vs REST decision guide:
  1. 1

    Choose gRPC for: high-throughput internal service-to-service calls, streaming large datasets, polyglot environments sharing one .proto file, and latency-sensitive paths like auth or pricing engines.

  2. 2

    Choose REST for: public-facing APIs consumed by browsers or mobile apps, teams unfamiliar with Protobuf tooling, and simple CRUD with infrequent traffic.

  3. 3

    Protocol: gRPC uses HTTP/2 (multiplexed, binary, compressed) vs HTTP/1.1 JSON for REST.

  4. 4

    Contract: the .proto file is the single source of truth — generated clients are fully typed; no OpenAPI drift.

  5. 5

    Streaming: gRPC supports server, client, and bidirectional streaming natively; REST requires SSE or WebSockets.