Information Technology Reference
In-Depth Information
classes, PUBClient and SUBServer for use by the two protocol implementations re-
spectively. A class diagram for our implementation is illustrated in Figure 6.1.As
described in Section 5.2,the Protocol class contains generalised code generation
and aspect-weaving capabilities making the addition of new protocols reasonably
straight forward.
Both the pub and the sub protocol support the following options:
initialContextFactory. The JMS JNDI [100] context that is used to obtain access to
the JMS implementation.
topic. ThenameoftheJMStopic.
servers. A comma-separated list defining the address of one or more JMS mes-
sage brokers in the format required by the underlying JMS implementation
(usually a URL).
In addition, the sub protocol provides the following options to support
durable topics as described in Section 2.6.3:
durable. Set to true or false , this declares that durable topics will be used.
subscriber. If the durable property is set to true above, then a network-wide name
must be defined so that a subscriber may be uniquely identified. This is used
in conjunction with the clientID below.
clientID. Used in conjunction with the subscriber property above, it is used to
uniquely identify a subscriber on the network.
Using the above method, both protocols were relatively easy to add with
the SUBProtocol class containing 397 lines of code and the PUBProtocol class
containing 363 lines. The helper classes SUBServer and PUBClient contain 238
and 168 lines of code respectively.
The above demonstrates that additional protocols may be added to RemoteJ
without the parser needing to be extended to support the new protocol.
6.2.3
Testing and Evaluation
To test our implementation, we created two simple, although representative,
classes, Publisher and Subscriber illustrated in Figure 6.2 and Figure 6.3 re-
spectively.
Our Publisher class simply calls the publish() method passing it a String
value and the Subscriber class calls the subscribe() method in a loop to demon-
strate that it may be called by multiple clients.
Applying the DDL illustrated in Figure 6.4 allows the subscribe() method
in the Subscriber class to asynchronously receive an event in the form of a string
published on the REMOTEJ.SEND topic.
The topic is also defined as durable so that the event will be delivered when
the subscriber application becomes available, if the event is published when the
subscriber is unavailable.
Search WWH ::




Custom Search