Table of Contents
Appia is an open source layered communication toolkit implemented in Java and providing extended configuration and programming possibilities. The Appia toolkit is composed by (1) a core that is used to compose protocols and (2) a set of protocols that provide group communication, ordering garanties, atomic broadcast, among other properties.
http://appia.di.fc.ul.pt/
The jGCS library provides a generic interface for Group Communication. This interface can be used by applications that need primitives from simple IP Multicast group communication to virtual synchrony or atomic broadcast. Its a common interface to several existing toolkits that provide different APIs.
http://jgcs.sourceforge.net/
This example shows how to use and configure Appia with jGCS using an open group, where there is a group of servers that accept Messages from external members. The example only shows how to configure and use, and it only sends dummy messages. It does not intend to implement any algorithm.
The example is composed by a server and a client. For this example to work, a gossip server must be used. To run the examples, use the following commands:
Download the code lab1.tar.gz.
Configure the config/server.xml and config/client.xml
java -cp build/:lib/log4j-1.2.14.jar:lib/jgcs-0.6.1.jar:lib/appia-core-4.1.2.jar:lib/appia-groupcomm-4.1.2.jar net.sf.appia.gossip.GossipServer -port 10000 -debug -solo
java -cp build/:lib/log4j-1.2.14.jar:lib/jgcs-0.6.1.jar:lib/appia-core-4.1.2.jar:lib/appia-groupcomm-4.1.2.jar ServerOpenGroupTest config/server.xml
java -cp build/:lib/log4j-1.2.14.jar:lib/jgcs-0.6.1.jar:lib/appia-core-4.1.2.jar:lib/appia-groupcomm-4.1.2.jar ClientOpenGroupTest config/client.xml
Note that before running this example, the address of the gossip must be properly set in the server.xml and client.xml files. Note that localhost address will not work:
<channel name="rrpc" template="tcp" initialized="no"> <memorymanagement size="40000000" up_threshold="15000000" down_threshold="7000000" /> <chsession name="remoteview"> <parameter name="gossip">**change_here**:10000</parameter> </chsession> <chsession name="remoteaddr"> <parameter name="group">group</parameter> </chsession> </channel>
The Gossip Server is a service provided by Appia to help the Group Communication protocols to discover new elements. When an element is started, it first connects to a gossip server that provides an address of an existing group communication member. Using this address, the new member can join the group. This is all transparent for the applications that are built on the top of the Appia group communication protocols. This is the server that needs to be started. The default port is 10000.
Open the clientMessage file. Observe the strategy pattern with ProtocolMessage class.
Add a new attribute to the Client message.
ClientMessage myMsg = new ClientMessage(smsg.id, "Hello");
Print the received message new attribute
System.out.println("Message was " + cliMsg.newAttr);
View the parameters on the client protocol stack
Start the server before connecting the client. Observe the results.
Start various servers and clients simultaneously.
Date: | 2012-02-14 |
---|---|
Version: | 1 |