What is an example in the real world that uses a mediation template?

Can someone give an example of use where the "intermediary pattern" is useful in the real world?

+5
source share
7 answers

Mediator is an approach to adding a third-party object to control the interaction between a group of (2 or more) objects.

The simplest example you can find is the Chat Room , where you can see that the ChatRoom object controls the interaction between 2 (or more) User Objects. In practice, if you see a web application, such as Facebook , it creates a web socket for each of the chat boxes that you open. Thus, the web socket interacts with the mediator (server) and the client. When group chat occurs, each client synchronizes with the server using dedicated web sockets.

+5
source

Taxi radio is an example of an intermediary template. Taxi drivers interact with the Intermediary (Radio Taxi Call Center), and not with each other.

, . GPS, , , , , . , , .

https://github.com/dstar55/100-words-design-patterns-java#Mediator

+3

The Gang of Four , , , , , , .. , . . . .

. , Spring Guru Spring Framework.

Spring MVC , Spring MVC .

+2

.

, , Java JMS-. , - JMS-; B JMS, . A B .

.

+1

, ESB (Enterprise Service Bus) .

+1

Another good example is the RabbitMQ open source message broker library, which acts as an intermediary for several clients / applications using it.

Here, clients or applications do not know from whom all messages will be consumed. RabbitMQ acts as an intermediary and publishes messages to subscribers.

0
source

Do not forget about Kafka, this is also a great example.

0
source

Source: https://habr.com/ru/post/1664456/


All Articles