Build custom connectors in Rust with Axum and the Omni connector SDK
The Rust SDK (omni-connector-sdk) is used by many built-in Omni connectors, including Google Workspace, Slack, Atlassian, IMAP, Nextcloud, Filesystem, Web, and Darwinbox. Use it when you want a native Rust connector with typed configuration, high-throughput sync logic, or direct reuse of Omni’s shared Rust models.
The Rust SDK is not published to crates.io. Connectors live in the Omni monorepo and depend on the SDK as a local path dependency.Create a connector under connectors/ and add a Cargo.toml like:
[package]name = "omni-my-connector"version = "0.1.0"edition = "2024"[dependencies]omni-connector-sdk = { path = "../../sdk/rust" }anyhow = "1"async-trait = "0.1"serde = { version = "1", features = ["derive"] }serde_json = "1"tokio = { version = "1", features = ["full"] }
The connector should be part of the Omni workspace so it is built, tested, and released with the matching SDK and shared model versions.
The SDK provides an Axum server with the standard connector endpoints and a registration loop that advertises the connector manifest to connector-manager every 30 seconds.
use anyhow::Result;use omni_connector_sdk::serve;use my_connector::MyConnector;#[tokio::main]async fn main() -> Result<()> { serve(MyConnector).await}
When running under Docker, set:
Variable
Purpose
CONNECTOR_MANAGER_URL
URL of omni-connector-manager
CONNECTOR_HOST_NAME
Hostname connector-manager should call back, usually the Docker Compose service name
emit_event() buffers events. Operations that checkpoint or terminate a sync flush buffered events first so the checkpoint does not race ahead of persisted events.
Use save_checkpoint after batches or remote pages that are safe to resume past:
let checkpoint = serde_json::json!({ "cursor": next_cursor });ctx.save_checkpoint(checkpoint).await?;
On the next run, connector-manager passes the latest checkpoint as the checkpoint argument to sync. ctx.is_resume() tells you whether the current run is a resume attempt after interruption.
Checkpoint only after the documents for that cursor/page have been emitted. The SDK flushes before checkpointing, but your connector still controls where the logical cursor advances.
Rust connectors should use integration tests wherever possible. Existing Rust connector tests under connectors/*/tests/ use testcontainers-backed ParadeDB, Redis, and connector-manager helpers from the repo’s shared test infrastructure.Recommended coverage: