Broker
This post is a cross-post from Brok.
The Broker Pattern structures distributed software systems that interact with remote service invocations. It is responsible for coordinating the communication, its results, and exceptions.
The Broker Pattern from the book?"Pattern-Oriented Software Architecture, Volume 1 " helps solve many challenges of distributed systems, such as finding the appropriate service provider, communicating with them securely, using the right programming language, or dealing with errors. This will not go into the details. It should only provide you with a rough idea of the Broker Pattern. For further information, study the pattern in the book "Pattern-Oriented Software Architecture, Volume 1 ".
Broker
Purpose
Solution
Structure
The Broker consists of five components:
Client
Client-side Proxy
Server
Server-side Proxy
Broker
There are more interesting aspects of the Broker Architecture.
{loadmoduleid 157}
Interface Definition Language
Typically, the server's services are specified in an interface definition language (IDL).?The IDL is the base?Client-Side Proxy, and the?Server-Side Proxy. Here are the two typical steps:
The IDL may also be registered within the Broker. This helps the broker to find the appropriate Server-Side Proxy, when asked by the Client-Side Proxy.
The benefit of the Broker architecture is that clients and servers can communicate with each other, although they speak different programming languages.
So far, I have described the static structure of the Broker Pattern. Let's consider the interplay between the client and the server.
The Client has a Request
When a client wants to use a remote service, it asks the Broker for it. The Broker returns the Client-Side Proxy that implements the remote service's interface. The Client-Side Proxy manages data caching, inter-process communication, or the marshaling /serialization of data. It connects with the Server-Side Proxy that calls the server. The?Server-Side Proxy has a similar job, such as the Client-Side Proxy. It unmarshals the data and speaks the language of the server. When the server sends back the function call result, it calls its Server-Side Proxy, which communicates with the client-side proxy.?
The Server registers itself
During the initialization of the system, the Broker starts itself and enters its event loop. The server initializes and registers itself with the Broker. The server receives the registration confirmation from the Broker and enters its event loop.
Additional Brokers
Sometimes there is more than one Broker. One Broker can, therefore, delegate the services request to another Broker. In this advanced architecture, each Broker must support two protocols. One internal protocol for its Client-Side Proxy and Server-Side Proxy and one external protocol for the other Broker.
There are many examples of Broker architectures.
Modernes C++ Mentoring
Stay informed: Subscribe.
Examples
The program rpcgen generates from an interface description stubs, skeletons, and an XDR file for data conversion
rpcgen provides an API for remote function calls in C
The rmic compiler generates the stubs and skeletons from a server interface in Java
In contrast to the function references in SunRPC , these are object references
Since Java 5, the stubs and skeletons are implicitly created by the Java Virtual Machine
CORBA uses the IDL for the interface description
The syntax of the IDL is C++ oriented
CORBA refers to objects such as RMI
Standardized implementation of the IDL2Language compiler exists for Ada, C, C++, Lisp, Smalltalk, Java, COBOL, PL/I, and Python
C++ Implementation: The ADAPTIVE Communication Environment (ACE)
The interface description language is called Web Service Definition Language (WSDL)
WSDL is a text-based protocol (XML)
The WSDL is not only declarative but specifies the type of data transfer and the service points
Implementations of a wsdl2Compiler code generator exist in Java, C++, Python, Perl, ...
C++ Implementation: gSOAP
Pros and Cons
Pros
Cons
What's Next?
The Model-View-Controller (MVC) is one of the classic architectural patterns. It divides the program logic of a user interface into separate components model, view, and controller. The model manages the data and rules of the application. The view represents the data, and the controller interacts with the user. Let me present the MVC in my next post.
?
Thanks a lot to my Patreon Supporters : Matt Braun, Roman Postanciuc, Tobias Zindl, G Prvulovic, Reinhold Dr?ge, Abernitzke, Frank Grimm, Sakib, Broeserl, António Pina, Sergey Agafyin, Андрей Бурмистров, Jake, GS, Lawton Shoemake, Animus24, Jozo Leko, John Breland, Venkat Nandam, Jose Francisco, Douglas Tinkham, Kuchlong Kuchlong, Robert Blanch, Truels Wissneth, Kris Kafka, Mario Luoni, Friedrich Huber, lennonli, Pramod Tikare Muralidhara, Peter Ware, Daniel Hufschl?ger, Alessandro Pezzato, Bob Perry, Satish Vangipuram, Andi Ireland, Richard Ohnemus, Michael Dunsky, Leo Goodstadt, John Wiederhirn, Yacob Cohen-Arazi, Florian Tischler, Robin Furness, Michael Young, Holger Detering, Bernd Mühlhaus, Matthieu Bolt, Stephen Kelley, Kyle Dean, Tusar Palauri, Dmitry Farberov, Juan Dent, George Liao, Daniel Ceperley, Jon T Hess, Stephen Totten, Wolfgang Fütterer, Matthias Grün, Phillip Diekmann, Ben Atakora, Ann Shatoff, Dominik Vo??ek, and Rob North.
Thanks, in particular, to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, Richard Sargeant, Rusty Fleming, John Nebel, Mipko, Alicja Kaminska, and Slavko Radman.
My special thanks to Embarcadero , PVS-Studio , and Tipi.build .
Seminars
I'm happy to give online seminars or face-to-face seminars worldwide. Please call me if you have any questions.
Bookable (Online)
German
Standard Seminars (English/German)
Here is a compilation of my standard seminars. These seminars are only meant to give you a first orientation.
New
Contact Me