Request/reply (RPC) RabbitMQ پر synchronous-style request-response communication کو messaging کے ذریعے فعال بناتا ہے — ایک client ایک request بھیجتا ہے اور reply queue کے ذریعے response حاصل کرتا ہے، correlation ID استعمال کرتے ہوئے responses کو requests سے match کرنے کے لیے۔ یہ service-to-service calls کے لیے ایک مفید pattern ہے۔
RabbitMQ میں RPC کیسے کام کرتا ہے
RPC pattern over messaging:
1. CLIENT sends a REQUEST message, including:
→ a REPLY-TO queue (where the response should go)
→ a CORRELATION ID (unique ID to match the response to this request)
2. SERVER (consumer) processes the request and sends a RESPONSE to the reply-to queue,
including the same CORRELATION ID
3. CLIENT receives the response from its reply queue, matches it by CORRELATION ID →
pairs the response with the original request
→ request-response over async messaging
