Questions
18 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?
18 / 25

How do you implement gRPC streaming including server-side, client-side, and bidirectional streaming in NestJS?

Difficulty: 7/10
server-side streaming, client-side streaming, bidirectional streaming

Server-side streaming returns an Observable<T> from the handler. Client-side streaming receives an Observable<T> as the first argument. Bidirectional streaming both receives and returns an Observable. NestJS maps these to the gRPC streaming types via @GrpcStreamMethod() and @GrpcStreamCall() decorators.

Server-side and client-side streaming handlers
gRPC streaming patterns:
  1. 1

    Server streaming — use for large dataset exports; client receives items as they become available.

  2. 2

    Client streaming — use for bulk ingestion; server processes a stream of items and returns a summary.

  3. 3

    Bidirectional streaming — use for real-time chat or live feeds; both sides send and receive concurrently.

  4. 4

    @GrpcStreamMethod() handles all streaming types — NestJS infers direction from the Observable positions.

  5. 5

    HTTP/2 multiplexing enables many concurrent streams over a single connection — very efficient for bulk transfers.

Scenario Questions

0-2 years experience

  1. 1We need a simple NestJS microservice that streams a list of numbers to a client using server‑side streaming. How would you set up the protobuf definition and the NestJS controller to achieve this?
  2. 2If a client calls a client‑side streaming RPC to upload a series of log entries, what NestJS decorators and method signature would you use to receive the stream?
  3. 3What happens if the client disconnects in the middle of a bidirectional stream? How does NestJS handle the termination?

2-5 years experience

  1. 1You added a bidirectional streaming endpoint to an existing NestJS service, but the client reports that it never receives responses after sending the first message. What are common pitfalls that could cause this, and how would you debug it?
  2. 2When implementing server‑side streaming for a large file download, you notice high memory usage. What changes can you make in NestJS to stream the file efficiently?
  3. 3Explain how you would add back‑pressure handling to a client‑side streaming RPC in NestJS.

5-8 years experience

  1. 1Design a scalable architecture for a NestJS gateway that aggregates data from multiple downstream gRPC services using bidirectional streams. What patterns would you use to manage flow control and fault tolerance?
  2. 2How would you instrument NestJS gRPC streaming endpoints to monitor latency and error rates in production, ensuring minimal impact on throughput?
  3. 3If you need to support both HTTP/1.1 and gRPC streaming over the same NestJS server, what configuration and routing considerations arise?

8+ years experience

  1. 1Our organization is migrating from a legacy REST API to a gRPC streaming architecture built on NestJS. What strategy would you propose to phase the migration while keeping backward compatibility and minimizing downtime?
  2. 2Across multiple teams, you need to define a shared protobuf contract for streaming data that evolves over time. How would you manage versioning and compatibility in NestJS services?
  3. 3Discuss the trade‑offs of using NestJS's built‑in gRPC transport versus a custom low‑level implementation for high‑throughput bidirectional streams in a multi‑region deployment.

Follow-up Questions

  • What challenges did you face when testing the stream locally?
  • How would you handle authentication for a streaming RPC?
  • Can you describe how you would scale this service under heavy load?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.