Interface MessageTransport

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
LoopbackTransport, RedisMessageTransport

public interface MessageTransport extends AutoCloseable
Low-level transport that moves encoded envelopes between network members.

A transport knows nothing about payload types or channels beyond routing: it accepts an already-encoded MessageEnvelope on publish(MessageEnvelope), and pushes decoded envelopes it receives to the MessageTransport.EnvelopeSink supplied at start(MessageTransport.EnvelopeSink). The two shipped implementations are the default plugin-messaging transport (per platform) and the Redis pub/sub transport; both are interchangeable behind this SPI, so a network can run with or without Redis.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Receives envelopes arriving from the network.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Stops the transport and releases resources.
    default boolean
    Returns whether the transport is currently connected/operational.
    Human-readable transport name for diagnostics/logging (for example "plugin-messaging", "redis").
    void
    Publishes an encoded envelope to the network.
    void
    Starts the transport and begins delivering received envelopes to the sink.
  • Method Details

    • name

      String name()
      Human-readable transport name for diagnostics/logging (for example "plugin-messaging", "redis").
      Returns:
      transport name
    • start

      Starts the transport and begins delivering received envelopes to the sink.

      Called once before any publish(MessageEnvelope). Implementations that need a background subscriber thread or channel registration set it up here.

      Parameters:
      sink - destination for received envelopes
    • publish

      void publish(MessageEnvelope envelope)
      Publishes an encoded envelope to the network.

      The envelope's Target is advisory; transports that cannot route precisely broadcast and rely on receiver-side filtering.

      Parameters:
      envelope - envelope to send
    • isConnected

      default boolean isConnected()
      Returns whether the transport is currently connected/operational.

      The default plugin-messaging transport reports connectivity based on whether the platform channel is registered; Redis reports pool health.

      Returns:
      true when the transport can currently deliver messages
    • close

      void close()
      Stops the transport and releases resources.
      Specified by:
      close in interface AutoCloseable