Interface Transport

All Known Implementing Classes:
InMemoryTransport, RabbitMqTransport

public interface Transport
A binding to one messaging protocol.

Implementations are discovered with ServiceLoader and selected by the scheme of the broker URL, so adding a broker to an application is a matter of putting a jar on the classpath rather than changing code.

capabilities() is the honest part of the contract. The core consults it before planning topology and either uses a native feature, applies a documented alternative, or fails at startup naming what is missing. A transport that overstates its capabilities turns a clear startup failure into a subtle production one.

  • Method Details

    • scheme

      String scheme()
      Returns:
      the URL scheme this transport handles, for example amqp or amqp10
    • schemes

      default Set<String> schemes()
      Every scheme this transport answers to.

      Exists because amqps:// is the same transport as amqp:// with the connection encrypted, not a different one, and a library where the secure URL fails to resolve is a library that teaches people to use the insecure one.

      Returns:
      the schemes, which must include scheme()
    • name

      String name()
      Returns:
      a short name for logs and diagnostics, such as rabbitmq
    • capabilities

      Set<Capability> capabilities()
      Returns:
      what brokers reachable through this transport can do
    • connect

      Opens a connection.
      Parameters:
      config - connection settings; ConnectionConfig.scheme() must match scheme()
      Returns:
      an open connection
      Throws:
      TransportException - if the broker cannot be reached or refuses the credentials