Message Broker Models
Message brokers offer two basic message distribution patterns or messaging styles:
Point-to-point messaging
This is the distribution pattern utilized in message queues where there is a one-to-one relationship between the message’s sender and receiver. Every single message in the queue is sent to one and only one recipient and is consumed exactly once.
Point-to-point messaging is principally used when a message must be acted upon only one time. Examples of this model can be found in suitable use cases for payroll and financial transaction processing. In these critical path systems, both the senders and receivers need an ironclad guarantee that each payment will be sent once and once only.
Publish/subscribe messaging
In this message distribution pattern (commonly known as “pub/sub”) the producer of each message publishes it to a topic message queue. This type of queue will allow multiple message consumers to subscribe to the queue and allow them to receive all messages that the queue receives. All messages published to a topic are distributed to all the receivers that have subscribed to it.
This is a broadcast-style distribution method where there is a one-to-many relationship between the message’s publisher and its consumers (unbeknownst to the publisher of the message). As an example, suppose an airline were to disseminate updates about arrivals, departures, or delay status of its flights. In such a scenario, multiple parties could make use of the information: ground crews performing aircraft maintenance and refueling, baggage handlers, flight attendants and pilots preparing for the plane’s next trip, and the operators of visual displays notifying the public. A pub/sub messaging style would be an appropriate implementation for use in this scenario.