Connecting Client and Server through a Dispatcher
If the peers in your application system know one another's locations, the Forwarder-Receiver pattern, described in the preceding section, is useful. Sometimes, though, it's best not to have direct connections between clients and servers. In such a case, you can add a layer of indirection between clients and servers to hide the locations and make the locations easier to change. This intermediary is a dispatcher.
Answering telephone calls
When you call a company to buy something, you may get a receptionist. After you tell the receptionist who you want to speak to, he puts you on hold and connects you to the right salesperson. You don't need the direct contact information for the person you're calling because there is a receptionist to connect your call. You don't know how the receptionist lets the person know that she has a call, and you don't need to know.
You're the client in this example, and the server is the person that you want to reach. The receptionist is the dispatcher, who serves an intermediary role and hides the details of your server's location. If you're trying to buy something from a salesperson (the server) and a new salesperson has been assigned for your region, the receptionist can connect you to the correct, new salesperson without your having to know anything about the selling company's internal structure.
Issuing ...
Get Pattern-Oriented Software Architecture For Dummies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.