Path: redb-route/redb.Route.Sftp/README.md Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Sftp/README.md ---- # redb.Route.Sftp > Documentation and articles: SFTP transport for redb.Route. Polling consumer and atomic producer via SSH.NET — key/password auth, proxy, idempotency, glob filtering, temp-file upload, chmod, and recursive directory traversal. [![NuGet](https://img.shields.io/nuget/v/redb.Route.Sftp?label=NuGet&color=blue)](https://www.nuget.org/packages/redb.Route.Sftp) [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue)](../../LICENSE) ## Installation ```bash dotnet add package redb.Route.Sftp ``` ## Usage ### Fluent DSL ```csharp using redb.Route.Sftp; // Poll remote directory From(Sftp.Directory("/uploads") .Host("sftp.example.com").Port(22) .Username("user").PrivateKey(Constant("/keys/id_rsa")) .Include("*.xml") .Delay(10000) .MoveTo("/uploads/archive") .Recursive() .Idempotent()) .Log("Downloaded: ${header.CamelFileName}") .To("direct://process"); // Upload files atomically From("direct://export") .To(Sftp.Directory("/outgoing") .Host("sftp.example.com") .Username("user").Password("secret") .TempPrefix(".uploading-") .Chmod("0644") .AutoCreate()); // With proxy From(Sftp.Directory("/data") .Host("internal-sftp") .Username("svc") .Proxy("Http", Constant("proxy.corp.net"), 8080) .ProxyAuth(Constant("proxy-user"), Constant("proxy-pass"))) .To("direct://ingest"); ``` ## Fluent Builder API | Category | Methods | |----------|---------| | **Connection** | `.Host()`, `.Port()`, `.Username()`, `.Password()`, `.PrivateKey()`, `.UseKeyboardInteractive()`, `.PreferredAuthentications()`, `.ServerFingerprint()`, `.StrictHostKeyChecking()`, `.KnownHostsFile()`, `.ConnectionTimeout()`, `.OperationTimeout()`, `.KeepAliveInterval()`, `.BufferSize()`, `.Compression()` | | **Proxy** | `.Proxy(type, host, port)`, `.ProxyAuth(user, pass)` | | **Reconnect** | `.MaximumReconnectAttempts()`, `.ReconnectDelay()`, `.Disconnect()` | | **Consumer** | `.Delay()`, `.InitialDelay()`, `.Include()`, `.Exclude()`, `.Recursive()`, `.MaxDepth()`, `.MinDepth()`, `.SortBy()`, `.MaxMessagesPerPoll()`, `.MinAge()`, `.MaxAge()` | | **Path filters** | `.AntInclude()`, `.AntExclude()`, `.AntFilterCaseSensitive()`, `.FilterDirectory()`, `.FilterFile()`, `.Filter()` — see [the base package](../redb.Route.GenericFile/README.md#path-filters); this is how one session polls named directories out of a partner tree instead of one route per directory | | **Poll backoff** | `.BackoffMultiplier()`, `.BackoffIdleThreshold()`, `.BackoffErrorThreshold()`, `.BackoffOnFailedExchanges()` | | **Post-process** | `.Noop()`, `.Delete()`, `.MoveTo()`, `.MoveExisting()`, `.PreMove()`, `.MoveFailed()` | | **Idempotency** | `.Idempotent()`, `.DoneFileName()` | | **Transfer** | `.Charset()`, `.Separator()` | | **Producer** | `.FileExist()`, `.TempPrefix()`, `.TempFileName()`, `.Chmod()`, `.ChmodDirectory()`, `.AutoCreate()`, `.AllowNullBody()`, `.EagerDeleteTargetFile()`, `.KeepLastModified()`, `.Flatten()`, `.JailStartingDirectory()`, `.AppendChars()` | > Most builder methods accept both constant values and `IExpression` for runtime resolution via the expression engine. ## Part of [redb.Route](../README.md) — ESB & EIP Framework for .NET ## Named connection factory Keep credentials out of the route URI: register a factory in the context registry and reference it by name. A set-but-unknown name fails loud at startup — a typo can never silently fall back to inline URI parameters. ```csharp context.AddToRegistry("prod", new SftpConnectionFactory { Host = "sftp.partner.com", Username = "exchange", PrivateKeyPath = "/secrets/id_ed25519", }); // sftp://outbox?connectionFactory=prod ``` ## Tracing As every connector built on `redb.Route.GenericFile` (see the `redb.Route.File` README): a root `Consumer` span, `file read sftp`, per routed file, none for an empty poll, an error when the route fails; a `Producer` span per upload, `file write sftp`, an error when it fails. `RouteEngineOptions.EnableTelemetry = false` opens neither.