Information Technology Reference
In-Depth Information
<<interface>
IProtocol
Protocol
PUBClient
PUBProtocol
SUBProtocol
SUBServer
Figure 6.1. Publish/subscribe class diagram. A UML class di-
agram showing the interaction between the protocol implementa-
tion classes.
are decoupled in time , space and synchronisation [34]. We therefore allow the pub
and sub protocols to be applied to classes independently.
As we do not support multiple methods receiving a single event and multiple
methods publishing objects to the same topic, pointcut statements must match
a single class/method. In addition, for both protocols, the methods matched by
the pointcut statement in the DDL must meet the following criteria:
• They must have a single serializable parameter that is either sent to the
subscriber or received from the producer.
• They must be declared as returning void .
Given the above, the method matched by the pointcut statement for the
pub protocol is altered to have its parameter published using options defined for
the protocol. The method should contain no code as the parameter is published
to the topic and any code in the method will be ignored.
For the sub protocol, the matched method receives a published object asyn-
chronously using options defined for the protocol, and the object may be published
by any publisher, providing the publishing system is sending serialized Java objects
that the sub protocol is expecting.
6.2.2
Adding the Protocols
As described in Section 5.2, additional protocols may be added by extending the
Protocol class, which implements the IProtocol interface. The name of the
protocol implementation class must be the same as the protocol name in uppercase
with the word 'Protocol' appended to it so that it may be dynamically loaded by
the ProtocolFactory class.
Our two protocols are therefore named PUBProtocol , for the pub protocol,
and SUBProtocol for the sub protocol.
In addition, we developed two helper
 
Search WWH ::




Custom Search