Search code examples
architecturemessage-queueterminologydistributed-systemmessagebroker

What is the difference between message queue and message broker?


From what I understand, a message queue helps with inter-process communication, but it is limited to basically allow communication between only 2 applications? I'm asking this because for example MSMQ (if my understanding is correct) only stores the message in the queue until it is processed by the first consumer, after which it will be automatically removed from the queue. Is this correct ?

Now message brokers are some sort of extension to message queue in that they provide a mechanism of a pub-sub relation, something like the observer does. Is my understanding correct ? If so, are there any other differences between the two? Also why would you want to use a message queue over a message broker since you will most likely use a distributed system which more than certainly will be composed of multiple services.


Solution

  • A message queue is a data structure, or a container - a way to hold messages for eventual consumption. A message broker is a separate component that manages queues.