One of the most common people believe is that when applications exchange information, the data flows between them most quickly when they are directly connected. Here are some examples:
In this example, we have two applications that need to exchange information.
In this example, we have a single application (App 1) that needs to exchange the same information with two applications (App 2 and App 3).
On the other hand, compare these to a third scenario where there is an intermediary message broker between the parties that are exchanging the information:
Functions of the Message Broker
The message broker’s main purpose is to transfer messages between the sending and receiving applications, but it also serves other purposes. For example:
- If the sending application is faster than the receiving application, the message broker holds the messages in a queue and allows the receiver to take them at its own pace.
- If multiple applications need the same information, the broker can send a copy of the received message to each application that needs it.
- If each of the receiving applications are accepting messages at different rates of speed, the broker can distribute those messages at the speed of each receiver. In the scenario similar to “Example 2” above, typically, the sender will send messages at the same speed as the slowest of the receiving applications.
- If there are differing privacy requirements for each of the receivers, the broker can filter out different fields for each of the copies of the same message being sent to each of the receivers.
- If a receiving application goes down, the message broker stores its messages until the application is back up. After the application starts working again, the broker completes the message delivery.
- The message broker maintains permissions controlling which applications are allowed to access what information.
- The message broker maintains a complete audit of which messages were delivered as well as when and to which receiving application they were sent.
Two Application Scenario
Given the responsibilities of the message broker, there is a slight chance that the “Example 1” scenario could deliver messages from App 1 to App 2 as quickly as the “Example 3” scenario with only two applications. This happens if App 2 is faster at receiving messages than App 1 is at sending them, or if App 2 doesn’t encounter any delays while receiving its messages (if it did, those delays would be passed on to App 1).
Many Application Scenario
In places where more than one application receives copies of the same published message, the message broker scenario is considerably more efficient from a network traffic perspective. Overall, it is much faster and much less taxing on the publisher of the information.
In all of these scenarios, because of the essential security and flow control features detailed above, the message broker solution puts significantly fewer burdens on the publishing application. In addition, it is simpler to implement in the long run when you consider everything that is needed for a secure production environment.