New version!

A new version of this website is available at architectural-patterns.net.

You just want the job to be done. You don't care who performs it, but you may have some demands. Tell your broker. He will take care of it.

Examples

  • CORBA (Common Object Request Broker Architecture)
  • Web Services
  • Jini

Where does it come from?

You go to a broker to buy a house. You don't want to need to know all about the housing business, costs, quality, suppliers. You just tell the broker your maximum price and some other requirements, and he starts looking.

When should you use it?

  • If the relation client-server is not fixed because there are many suitable servers or the availability of the servers changes over time.
  • The choice of server depends on some criterion that is complex enough to be delegated to a separate component.
  • If you want to be independent of the physical location of the server (location transparacy).

How does it work?

At all times servers can register and deregister themselves with the broker. If a server fails, it will be automatically (after a timeout) unregistered by the broker.

The client requests a specific service. It formats its request in a specific format and sends it to its broker. The broker then selects the most suitable server to process the request. When the link between the client and the server is set up, they may start communicating directly, freeing the broker.


Picture: Broker Architecture

There may also be multiple brokers in an architecture. These will then need their own communication protocols.

Problems

Once you set up the broker, it is easy to program the service calls. Take care to handle transactions and exceptions well, though.

Common implementations

  • Web Services
  • CORBA

Links