Request/reply (RPC) RabbitMQ ਉੱਤੇ synchronous-style request-response ਸੰਚਾਰ ਨੂੰ messaging ਰਾਹੀਂ ਸਮਰੱਥ ਬਣਾਉਂਦਾ ਹੈ — ਇੱਕ ਕਲਾਇੰਟ ਇੱਕ request ਭੇਜਦਾ ਹੈ ਅਤੇ reply queue ਰਾਹੀਂ response ਪ੍ਰਾਪਤ ਕਰਦਾ ਹੈ, correlation ID ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹੋਏ responses ਨੂੰ requests ਨਾਲ ਮੇਲ ਕਰਨ ਲਈ। ਇਹ service-to-service ਕਾਲਾਂ ਲਈ ਇੱਕ ਉਪਯੋਗੀ 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
