Explain the publish/subscribe pattern and how it enables loose coupling between microservices.

Last updated 3 July 2026

  • Publish/subscribe: publishers emit events to a topic and subscribers receive events they registered for. A message broker (Kafka, RabbitMQ, SNS/SQS) sits between them and handles routing and fan-out.

  • Loose coupling comes from three decouplings: location (neither side knows the other), temporal (the broker buffers for offline subscribers), and cardinality (new consumers are added without touching the publisher).

  • Trade-offs: flows are harder to trace and debug, data is eventually consistent, and the broker becomes critical infrastructure that must be highly available.

  • https://vamsilabs.netlify.app/microservices/microservices/
All Microservices interview questions