# Package org.apache.catalina.tribes

Apache Tribes - The Tomcat Cluster Communication Module QuickStart `//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);` Interfaces for the Application Developer `org.apache.catalina.tribes.Channel` Main component to interact with to send messages `org.apache.catalina.tribes.MembershipListener` Listen to membership changes `org.apache.catalina.tribes.ChannelListener` Listen to data messages `org.apache.catalina.tribes.Member` Identifies a node, implementation specific, default is org.apache.catalina.tribes.membership.MemberImpl Interfaces for the Tribes Component Developer `org.apache.catalina.tribes.Channel` Main component to that the application interacts with `org.apache.catalina.tribes.ChannelReceiver` IO Component to receive messages over some network transport `org.apache.catalina.tribes.ChannelSender` IO Component to send messages over some network transport `org.apache.catalina.tribes.MembershipService` IO Component that handles membership discovery and `org.apache.catalina.tribes.ChannelInterceptor` interceptors between the Channel and the IO layer `org.apache.catalina.tribes.ChannelMessage` The message that is sent through the interceptor stack down to the IO layer `org.apache.catalina.tribes.Member` Identifies a node, implementation specific to the underlying IO logic

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  Channel | Channel interface A channel is a representation of a group of nodes all participating in some sort of communication with each other.
  ChannelInterceptor | A ChannelInterceptor is an interceptor that intercepts messages and membership messages in the channel stack.
  ChannelInterceptor.InterceptorEvent |
  ChannelListener | Title: ChannelListener Description: An interface to listens to incoming messages from a channel When a message is received, the Channel will invoke the channel listener in a conditional sequence.
  ChannelMessage | Message that is passed through the interceptor stack after the data serialized in the Channel object and then passed down to the interceptor and eventually down to the ChannelSender component
  ChannelReceiver | ChannelReceiver Interface The `ChannelReceiver` interface is the data receiver component at the bottom layer, the IO layer (for layers see the javadoc for the `Channel` interface).
  ChannelSender | ChannelReceiver Interface The `ChannelSender` interface is the data sender component at the bottom layer, the IO layer (for layers see the javadoc for the `Channel` interface).
  ErrorHandler | The `ErrorHandler` class is used when sending messages that are sent asynchronously and the application still needs to get confirmation when the message was sent successfully or when a message errored out.
  Heartbeat | Can be implemented by the ChannelListener and Membership listeners to receive heartbeat notifications from the Channel
  ManagedChannel | Channel interface A managed channel interface gives you access to the components of the channels such as senders, receivers, interceptors etc for configurations purposes
  Member | The Member interface, defines a member in the group.
  MembershipListener | The MembershipListener interface is used as a callback to the membership service.
  MembershipService | MembershipService Interface The `MembershipService` interface is the membership component at the bottom layer, the IO layer (for layers see the javadoc for the `Channel` interface).
  MessageListener | Title: MessageListener Description: The listener to be registered with the ChannelReceiver, internal Tribes component

- Class Summary
  Class | Description
  --- | ---
  ByteMessage | A byte message is not serialized and deserialized by the channel instead it is sent as a byte array By default Tribes uses java serialization when it receives an object to be sent over the wire.
  ChannelException.FaultyMember | Title: FaultyMember class Description: Represent a failure to a specific member when a message was sent to more than one member
  Constants | Deprecated Unused - will be removed in 8.0.x
  UniqueId | Title: Represents a globally unique Id Company:

- Exception Summary
  Exception | Description
  --- | ---
  ChannelException | Channel Exception A channel exception is thrown when an internal error happens somewhere in the channel.
  RemoteProcessException | Title: RemoteProcessException Description: Message thrown by a sender when USE_SYNC_ACK receives a FAIL_ACK_COMMAND.

## Package org.apache.catalina.tribes Description

Apache Tribes - The Tomcat Cluster Communication Module

### QuickStart

                //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);

### Interfaces for the Application Developer

1. `org.apache.catalina.tribes.Channel` Main component to interact with to send messages
2. `org.apache.catalina.tribes.MembershipListener` Listen to membership changes
3. `org.apache.catalina.tribes.ChannelListener` Listen to data messages
4. `org.apache.catalina.tribes.Member` Identifies a node, implementation specific, default is org.apache.catalina.tribes.membership.MemberImpl

### Interfaces for the Tribes Component Developer

1. `org.apache.catalina.tribes.Channel` Main component to that the application interacts with
2. `org.apache.catalina.tribes.ChannelReceiver` IO Component to receive messages over some network transport
3. `org.apache.catalina.tribes.ChannelSender` IO Component to send messages over some network transport
4. `org.apache.catalina.tribes.MembershipService` IO Component that handles membership discovery and
5. `org.apache.catalina.tribes.ChannelInterceptor` interceptors between the Channel and the IO layer
6. `org.apache.catalina.tribes.ChannelMessage` The message that is sent through the interceptor stack down to the IO layer
7. `org.apache.catalina.tribes.Member` Identifies a node, implementation specific to the underlying IO logic

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.