Interface ChannelAdapterFactory

All Known Implementing Classes:
CliChannelFactory, DiscordChannelFactory, EmailChannelFactory, SlackChannelFactory, TelegramAdapterFactory, WhatsAppChannelFactory

public interface ChannelAdapterFactory
SPI factory for creating channel adapters.

Implementations are discovered via ServiceLoader and registered in META-INF/services/com.tnsai.channels.api.ChannelAdapterFactory.

Unlike direct ChannelAdapter SPI registration, factories support:

  • Classpath availability checks via isAvailable()
  • Configuration-driven adapter creation
  • Lazy instantiation — adapters are only created when needed
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    create(Object config)
    Creates a new adapter instance with the given configuration.
    Human-readable display name for UI and logging.
    Unique type identifier for this channel (e.g.
    boolean
    Whether the required platform SDK classes are on the classpath.
  • Method Details

    • getType

      String getType()
      Unique type identifier for this channel (e.g. "telegram", "discord", "slack").
    • getDisplayName

      String getDisplayName()
      Human-readable display name for UI and logging.
    • create

      ChannelAdapter create(Object config)
      Creates a new adapter instance with the given configuration.
      Parameters:
      config - platform-specific configuration (e.g. bot token, webhook URL)
      Returns:
      a configured but not yet started adapter
    • isAvailable

      boolean isAvailable()
      Whether the required platform SDK classes are on the classpath.

      This allows consumers to discover which adapters are actually usable at runtime, since platform SDKs are optional dependencies.

      Returns:
      true if all required dependencies are available