Broker Pattern Teemu Koponen tkoponen@iki.fi
Broker Pattern Context and problem Solution Implementation Conclusions Comments & discussion
Example Application Stock Exchange Trader 1 Stock Exchange 1 Trader 2 Trader 3 Stock Exchange 2
Context Distributed environment Heterogeneous systems Independent co-operating components
Problem Distributed components need to communicate (IPC) Essentially distributed vs. centralised should make no difference Dynamic service configuration required
Forces Components require access to remote services location-transparently Need to change, add and remove components at run-time System and implementation specific details should be hidden from the users of the components
Broker Pattern Context and problem Solution Implementation Conclusions Comments & discussion
Solution (1/9) Introduce a Broker component Broker one who acts as an intermediary Four new participating component types: brokers, bridges, client-side proxies and server-side proxies Trader Stock Exchange
Solution Broker Component (2/9) Broker is a messenger Transmits requests, responses and errors Locates the servers APIs for the clients and the servers
Solution Server Component (3/9) Server Object implements the service Service Interface Binary interface or High level interface (IDL) Registers itself to Broker
Solution Server Component (4/9) Stock Exchange Server Server-side Proxy Broker Initialisation Service reg. Response Response
Solution Client Component (5/9) Client access remote services Access through Broker Direct communication Indirect commication Location transparency
Solution Client & Server Side Proxies (6/9) Provide transparency to client and server objects Closely coupled Hide implementation details of IPC (Un)Marshaling
Stock Exchange Example (7/9) Trader Stock Exchange Client Client-side Proxy Broker Server-side Proxy Server Send req. Forward req. Call service Run service Result Return Forward resp.
Solution Bridge Component (8/9) Broker interoperability Mediator Hides the implementation details Trader Stock Exchange 3
Solution Variations (9/9) Indirect vs. direct communication Message Passing Broker Trader System Adapter Broker System
Broker Pattern Context and problem Solution Implementation Conclusions Comments & discussion
Implementation (1/6) Design Object Model Remoting objects Select type of componentinteroperability Binary or High level
Implementation (2/6) Proxies Specify the APIs of Broker Client and server side proxies Broker Indirect or direct communication Specify on-the-wire protocol Asynchronous support Dynamic methods Directory service Name service Error handling
Implementation (3/6) If high level component inter-operability Specify Interface Description Language (IDL) Design IDL compiler IDL compiler framework for portability If binary component inter-operability Language specific libraries
Implementation Real life Brokers (4/6) CORBA IONA Orbix Borland Inprise VisiBroker Microsoft OLE WWW
Implementation - CORBA (5/6) Broker in client and server Extra services High level interface (IDL) Client Object Client-side proxy ORB Server Object Server-side proxy (POA) ORB GIOP/IIOP
Implementation WWW (6/6) Broker coupled to the client Binary interface GUI Browser Engine WWW Site HTTP
Broker Pattern Context and problem Solution Implementation Conclusions Comments & discussion
Conclusions (1/3) Benefits Location transparency Changeability Extensibility Portability Reusability Interoperability of brokers Testing & debugging
Conclusions (2/3) Liabilities Efficiency Fault-tolerancy Testing & debugging
Related Patterns (3/3) Forwarder-Receiver Proxy Client-Dispatcher-Server Mediator
References [1] Pattern Oriented Software Architecture, A System of Patterns, F. Buschmann, R. Meunier, H. Rohnert, P. Sommerlad, M. Stal, Wiley, 1996 [2] Enterprise CORBA, D. Slama, J. Garbis, P. Russell, Prentice Hall, 1999 [3] Design Patterns, Elements of Reusable Object-Oriented Software, E. Gamma, R. Helm, R. Johnson, J. Vlissides, Addison- Wesley, 1995
Broker Pattern Context and problem Solution Implementation Conclusions Comments & discussion
Broker Pattern Comments, questions? Discussion