Class ClusterPacketRouter

  • All Implemented Interfaces:
    RemotePacketRouter

    public class ClusterPacketRouter
    extends Object
    implements RemotePacketRouter
    Route packets to other nodes of the cluster. If the remote node was not found or failed to be reached then depending on the type of packet an error packet will be returned. In case the remote node is reached but the remote node fails to route the packet to the recipient (e.g. the recipient just left) then an error packet may be created from the remote node and send it back to this node.

    Author:
    Gaston Dombiak
    • Constructor Detail

      • ClusterPacketRouter

        public ClusterPacketRouter()
    • Method Detail

      • routePacket

        public boolean routePacket​(byte[] nodeID,
                                   org.xmpp.packet.JID receipient,
                                   org.xmpp.packet.Packet packet)
        Description copied from interface: RemotePacketRouter
        Routes packet to specified receipient hosted in the specified node.
        Specified by:
        routePacket in interface RemotePacketRouter
        Parameters:
        nodeID - the ID of the node hosting the receipient.
        receipient - the target entity that will get the packet.
        packet - the packet to send.
        Returns:
        true if the remote node was found.
      • broadcastPacket

        public void broadcastPacket​(org.xmpp.packet.Message packet)
        Description copied from interface: RemotePacketRouter
        Brodcasts the specified message to all local client sessions of each cluster node. The current cluster node is not going to be included.
        Specified by:
        broadcastPacket in interface RemotePacketRouter
        Parameters:
        packet - the message to broadcast.