java/org/apache/catalina/tribes/package.html
//create a channel
Channel myChannel = new GroupChannel();
//create my listeners
MyMessageListener msgListener = new MyMessageListener();
MyMemberListener mbrListener = new MyMemberListener();
//attach the listeners to the channel
myChannel.addMembershipListener(mbrListener);
myChannel.addChannelListener(msgListener);
//start the channel
myChannel.start(Channel.DEFAULT);
//create a message to be sent, message must implement java.io.Serializable
//for performance reasons you probably want them to implement java.io.Externalizable
Serializable myMsg = new MyMessage();
//retrieve my current members
Member[] group = myChannel.getMembers();
//send the message
channel.send(group,myMsg,Channel.SEND_OPTIONS_DEFAULT);
org.apache.catalina.tribes.Channel Main component to interact with to send messagesorg.apache.catalina.tribes.MembershipListener Listen to membership changesorg.apache.catalina.tribes.ChannelListener Listen to data messagesorg.apache.catalina.tribes.Member Identifies a node, implementation specific, default is org.apache.catalina.tribes.membership.MemberImplorg.apache.catalina.tribes.Channel Main component to that the application interacts withorg.apache.catalina.tribes.ChannelReceiver IO Component to receive messages over some network transportorg.apache.catalina.tribes.ChannelSender IO Component to send messages over some network transportorg.apache.catalina.tribes.MembershipService IO Component that handles membership discovery andorg.apache.catalina.tribes.ChannelInterceptor interceptors between the Channel and the IO layerorg.apache.catalina.tribes.ChannelMessage The message that is sent through the interceptor stack down to the IO layerorg.apache.catalina.tribes.Member Identifies a node, implementation specific to the underlying IO logic