4 Event-based bus architectures
Many of you will already be familiar with event processing if you have developed visual interfaces with the later versions of Java. Developing such an interface consists of a number of steps:
A visual object such as a button is placed in a container such as an applet or a object.
An object such as a container implements a listener interface.
Methods in the interface which the container implements will react to events such as a button being clicked or a pull-down menu being activated and an item selected. The code for these methods is provided within the container class.
Finally, code is placed either in the constructor for the container or in the method for an applet, which registers the container as a listener to certain events such as a button being clicked.
This model of processing is based on code being written which responds to events such as a button being clicked, a window being closed and text being deleted from a text box.
The same model of processing is used in bus architectures. An example of such an architecture is shown in Figure 3. Here a bus connects a number of listener objects to a transmitter object which sends data along the bus. When data appears on the bus each listener object is executed to read and process the data.
In order to listen to data which is being transferred across a bus the listener objects have to be registered with the bus in the same way that event handlers need to be registered when developing visual interfaces.
An object bus is very much like a radio transmitter in that listeners to a radio station tune into a channel and receive data (sound) transmitted by the radio transmitter. In the bus architecture listener objects tune into a channel (subscribe) and receive objects which are dispatched along the bus.
The model here is somewhat different to that of the distributed object model. In that model, objects communicate with other objects via method calls; invariably the client initiates the processing with the server being a passive entity until it receives some request for a service. This is an example of pull technology where clients pull data from servers. The object bus model is an example of push technology where the server is pushing data out to the clients which, when they receive it, carry out some processing action.
The object bus architecture is particularly well suited to applications where realtime events are being generated and have to be processed by a dynamically changing collection of listener objects. Typical applications include:
The delivery of stock market data to financial subscribers on a real-time basis.
Teleconferencing applications where messages from conference participants have to be broadcast in real-time to other participants.
Distributed multimedia applications such as video on demand where large chunks of data have to be delivered to subscribers on a real-time basis.
Conversational applications such as chat rooms where a number of participants communicate with each other in real-time.