Package com.tnsai.channels.api
Interface ChannelAdapter
- All Known Subinterfaces:
StreamingChannelAdapter
- All Known Implementing Classes:
CliChannel,DiscordChannel,EmailChannel,SlackChannel,TelegramAdapter,WhatsAppChannel
public interface ChannelAdapter
Core contract for messaging channel integrations.
Each channel (Telegram, Discord, Slack, etc.) implements this interface
and registers via SPI (META-INF/services/com.tnsai.channels.api.ChannelAdapter).
Lifecycle: start(com.tnsai.channels.api.ChannelContext) is called once by the ChannelRegistry
with a ChannelContext for delivering inbound messages. stop() tears down the connection.
-
Method Summary
Modifier and TypeMethodDescriptionDeclares what this channel supports.Human-readable display name.id()Unique identifier for this channel (e.g.booleanWhether the adapter is currently connected and operational.voidsend(UnifiedResponse response) Send a response back through this channel.voidstart(ChannelContext context) Start listening for inbound messages.voidstop()Stop listening and release resources.
-
Method Details
-
id
String id()Unique identifier for this channel (e.g. "telegram", "discord", "slack"). -
displayName
String displayName()Human-readable display name. -
capabilities
ChannelCapabilities capabilities()Declares what this channel supports. -
start
Start listening for inbound messages. The adapter should callChannelContext.onMessage(com.tnsai.channels.api.UnifiedMessage)when a message arrives.- Parameters:
context- callback interface for delivering events to the gateway
-
stop
void stop()Stop listening and release resources. -
send
Send a response back through this channel.- Parameters:
response- the unified response to deliver
-
isRunning
boolean isRunning()Whether the adapter is currently connected and operational.
-