Interface BabelChannel

All Known Subinterfaces:
BroadcastIPBabelChannel, IPBabelChannel
All Known Implementing Classes:
AbstractTCPBabelChannel, ComposedBabelChannel, InternalBabelChannel, LegacySimpleServerBabelChannel, QUICBabelChannel, TCPBabelChannel, TLSBabelChannel, UDPBabelChannel

public interface BabelChannel
Represents a communication channel between two Babel runtimes. This interface only has a single connect method that connects to another Babel runtime.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Connect to another Babel runtime.
    void
    Closes the connection to peer.
    default BabelChannel
    Gets this channel or returns the inner channel if this instance is a wrapper.
    boolean
    Returns true if a connection to peer is currently open on this channel.
    void
    send(BabelNode peer, BabelMessage message)
    Sends a message through this channel to the given peer using a persistent connection.
    void
    Sends a message to peer without establishing a persistent connection.
    void
    Releases all resources held by this channel, closing any open connections.
  • Method Details

    • connect

      void connect(BabelNode peer)
      Connect to another Babel runtime. The pecularities of how a channel "connects" to another Babel runtime is up to its implementation. Whether the connection is successful or not, this method should trigger the ConnectionUpEvent or ConnectionFailedEvent. May throw UnsupportedOperationException
      Parameters:
      peer - the peer to connect to
    • send

      void send(BabelNode peer, BabelMessage message)
      Sends a message through this channel to the given peer using a persistent connection. If the connection is not currently open, the message may be queued depending on the implementation.
      Parameters:
      peer - the peer to send the message to
      message - the message to be sent
    • sendEphemeral

      void sendEphemeral(BabelNode peer, BabelMessage message)
      Sends a message to peer without establishing a persistent connection. The channel implementation may use a transient transport internally, but none of the connection lifecycle events (connectionUp / connectionDown) are triggered.
      Parameters:
      peer - the target node
      message - the message to deliver
    • disconnect

      void disconnect(BabelNode peer)
      Closes the connection to peer. A ConnectionDownEvent will be delivered to interested protocols after the connection has been torn down.
      Parameters:
      peer - the node to disconnect from
    • isConnected

      boolean isConnected(BabelNode peer)
      Returns true if a connection to peer is currently open on this channel.
      Parameters:
      peer - the node whose connection status is queried
      Returns:
      true if connected, false otherwise
    • shutdown

      void shutdown()
      Releases all resources held by this channel, closing any open connections.
    • getInner

      default BabelChannel getInner()
      Gets this channel or returns the inner channel if this instance is a wrapper.
      Returns:
      the underlying BabelChannel instance