ਇੱਕ ਸਿਸਟਮ ਵਿੱਚ، ਹਿੱਸੇ (ਸੇਵਾਵਾਂ، ਕਲਾਇੰਟ) APIs ਅਤੇ ਵੱਖ-ਵੱਖ ਪ্ਰੋਟੋਕੋਲ ਰਾਹੀਂ ਸੰਚਾਰ ਕਰਦੇ ਹਨ — ਸਮਕਾਲੀ (REST, gRPC) ਅਤੇ ਅਸਮਕਾਲੀ (ਮੈਸੇਜਿੰਗ/ਕਤਾਰਾਂ)। ਇਹ ਸਮਝਣਾ ਕਿ ਹਿੱਸੇ ਕਿਵੇਂ ਸੰਚਾਰ ਕਰਦੇ ਹਨ، ਮਲਟੀ-ਪਾਰਟ ਸਿਸਟਮ ਡਿਜ਼ਾਈਨ ਕਰਨ ਲਈ ਮੌਲਿਕ ਹੈ।
ਸਮਕਾਲੀ ਸੰਚਾਰ (ਬੇਨਤੀ/ਜਵਾਬ)
The caller WAITS for a response (blocking):
REST (HTTP) → most common; resources over HTTP (JSON) → simple, ubiquitous, web-friendly
gRPC → high-performance RPC (binary, HTTP/2) → fast, typed; good for internal services
GraphQL → flexible queries (client requests exactly what it needs)
→ for: direct request/response where the caller needs an answer now
ਅਸਮਕਾਲੀ ਸੰਚਾਰ (ਮੈਸੇਜਿੰਗ)
The caller does NOT wait (decoupled, non-blocking):
MESSAGE QUEUES (RabbitMQ, SQS) → send a message; a consumer processes it later
EVENT STREAMING (Kafka) → publish events; consumers react
PUB/SUB → broadcast events to subscribers
→ for: decoupling, background work, handling spikes, event-driven systems
✓ resilience (queue buffers), scalability, decoupling ✗ more complexity, eventual consistency
