Skip to main content
The palyra-connectors crate provides a provider-neutral runtime for managing external communication platforms (e.g., Discord, Slack). It handles message persistence, outbound queuing with retry logic, dead-lettering, and media artifact management via a centralized supervisor.

Architecture Overview

The connector subsystem is divided into a generic Core runtime and specific Provider adapters. The ConnectorSupervisor acts as the orchestrator, utilizing a ConnectorStore for persistence and a ConnectorRouter to dispatch inbound messages to the daemon’s gateway.

System Entity Mapping

The following diagram maps high-level connector concepts to their specific Rust implementations and storage entities. Connector Entity Mapping Sources: crates/palyra-connectors/src/lib.rs#1-10, crates/palyra-connectors/src/core/mod.rs#9-30

Connector Supervisor

The ConnectorSupervisor is the primary interface for the ChannelPlatform in the daemon. It manages the lifecycle of connector instances and handles the “drain” loop for outbound messages.

Key Functions

Data Flow: Outbound Message

Sources: crates/palyra-connectors/src/core/supervisor.rs#1-30, crates/palyra-daemon/src/channels/discord.rs#112-152

Provider Implementations

Palyra uses a trait-based system (ConnectorAdapter) to support multiple platforms.
ProviderImplementationStatusDescription
DiscordDiscordConnectorAdapterSupportedFull support for messaging, threads, reactions, and media crates/palyra-connectors/src/providers/discord/mod.rs#34-37.
EchoEchoConnectorAdapterInternalA loopback provider used for testing and diagnostics crates/palyra-connectors/src/providers/echo.rs#25-28.
SlackSlackConnectorAdapterDeferredRoadmap item; currently returns PermanentFailure crates/palyra-connectors/src/providers/slack.rs#15-26.
TelegramTelegramConnectorAdapterDeferredRoadmap item; currently returns PermanentFailure crates/palyra-connectors/src/providers/telegram.rs#15-26.

Echo Provider (Simulator)

The EchoConnectorAdapter is used extensively in the simulator_harness.rs to verify the supervisor’s state machine. It supports special markers like [connector-crash-once] to trigger simulated failures and verify that the supervisor correctly retries the message crates/palyra-connectors/src/providers/echo.rs#123-136. Sources: crates/palyra-connectors/src/providers/discord/mod.rs#1-63, crates/palyra-connectors/src/providers/echo.rs#1-45, crates/palyra-connectors/src/providers/slack.rs#1-26, crates/palyra-connectors/src/providers/telegram.rs#1-26

Storage and Reliability

ConnectorStore

The ConnectorStore is a SQLite-backed persistence layer. It maintains several critical tables:

Dead-Letter Queues (DLQ)

When a message cannot be delivered, it is moved to the DLQ. Operators can view these via the Console or CLI. Sources: crates/palyra-connectors/src/core/storage.rs#1-26, crates/palyra-daemon/src/transport/http/handlers/console/channels/mod.rs#51-77

Testing and Simulation

The simulator_harness.rs provides a deterministic environment for testing connector logic without external network dependencies.

Key Testing Entities

Sources: crates/palyra-connectors/tests/simulator_harness.rs#1-110