Skip to main content
InterviewHubPRO
Section Overview
Q19

Question 19 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

38%
RabbitMQ & AMQP (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

How do you implement RPC (Remote Procedure Call) patterns in RabbitMQ?

senior LevelSystem DesignRabbitMQMicroservices

In Simple Words: AMQP supports two-way request-response patterns over asynchronous queues using message headers:

  1. The Client generates a unique correlation_id (e.g. UUID) and creates an exclusive callback reply queue.
  2. The Client publishes the request with:
    • reply_to: callback_queue_name
    • correlation_id: "corr_492"
  3. The Server processes the request and publishes the response directly to the queue specified in reply_to, preserving the same correlation_id.
  4. The Client listens on its callback queue, matches the correlation_id, and resolves the promise.