Solution: Use a Broker

Structure distributed systems so that the components communicate via remote service invocation. A broker component coordinates communication of requests from client to server and also coordinates returning the results from server to client.

Looking inside a broker system

Three main components are involved in a broker system: the broker, the server, and the client. Figure 12-7 shows a simple class diagram.


Figure 12-7: A broker system at its simplest.

In addition to these components, a broker system features proxies and bridges. I describe all these elements in the following sections.

The broker

The broker is the message-routing component of your system. It passes messages from client to server and from server to client. These messages are requests for services and replies to those requests, as well as messages about exceptions that have occurred. The requests are coded as calls to the broker's API. The broker is responsible for error handling in response to these exception reports.

Figure 12-8 shows the Class-Responsibility-Collaborator (CRC) card for the broker. (I introduce CRC cards in Chapter 2.)


Figure 12-8: The broker CRC card.

The broker must be able to locate the servers to which it sends requests, so it maintains a registry of the servers and their ...

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.