Interface Channel

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
Connector, Receiver, Sender

public interface Channel extends AutoCloseable
Represents a channel for sending or receiving messages. While nothing prevents having full-duplex channels, we generally find it more useful to have separate channels for sending and receiving messages. This interface is used to abstract the underlying transport protocol.
Author:
Domenico Barra - domenico@adamantic.io
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the channel.
    The name of the channel.
    void
    Opens the channel for sending or receiving messages.
    Returns the state of the channel.
  • Method Details

    • name

      String name()
      The name of the channel. This is used to identify the channel in the system, configuration, and logs.
      Returns:
      the name of the channel.
    • open

      void open() throws IOException
      Opens the channel for sending or receiving messages.
      Throws:
      IOException - if the channel cannot be opened.
    • close

      void close()
      Closes the channel. It is a requirement that this method be idempotent and not throw any exceptions.
      Specified by:
      close in interface AutoCloseable
    • state

      ChannelState state()
      Returns the state of the channel.
      Returns:
      the state of the channel.