redb.Route.GenericFile
2.0.2
Prefix Reserved
dotnet add package redb.Route.GenericFile --version 2.0.2
NuGet\Install-Package redb.Route.GenericFile -Version 2.0.2
<PackageReference Include="redb.Route.GenericFile" Version="2.0.2" />
<PackageVersion Include="redb.Route.GenericFile" Version="2.0.2" />
<PackageReference Include="redb.Route.GenericFile" />
paket add redb.Route.GenericFile --version 2.0.2
#r "nuget: redb.Route.GenericFile, 2.0.2"
#:package redb.Route.GenericFile@2.0.2
#addin nuget:?package=redb.Route.GenericFile&version=2.0.2
#tool nuget:?package=redb.Route.GenericFile&version=2.0.2
redb.Route.GenericFile
Shared base library for file-based transports in the redb.Route ESB framework.
Provides abstract consumer, producer, options, and file-operations interfaces that concrete transports (File, FTP, SFTP) inherit from. Not used directly — include one of the transport-specific packages instead.
Architecture
GenericFileEndpointOptions ← base options (polling, filtering, producer write)
└─ RemoteFileEndpointOptions ← + host/port/auth/reconnect
GenericFileConsumer<TOptions> ← template-method poll loop
└─ RemoteFileConsumer<TOptions> ← + connect/reconnect lifecycle
GenericFileProducer<TOptions> ← template-method write flow
└─ RemoteFileProducer<TOptions> ← + connect/reconnect lifecycle
IFileOperations ← protocol abstraction (list, read, write, move, delete)
└─ IRemoteFileOperations ← + connect/disconnect
Transport implementations (File, Ftp, Sftp) provide concrete IFileOperations and transport-specific headers/DSL. All polling logic, filtering, idempotency, post-processing, atomic write, and file-exist strategies are implemented in this base library.
Consumer Pipeline
The GenericFileConsumer runs a poll loop with the following steps:
- List files in the base directory (optionally recursive)
- Filter — exclude temp/internal files (
.redb_*, temp prefix), apply globinclude/excludepatterns - Sort — by name, date, or size (ascending or descending)
- Limit — apply
maxMessagesPerPoll - Per-file checks —
minAge,maxAge, done-file presence, idempotency repository - Pre-move — optionally move to a staging directory before processing
- Read body — as
byte[](default) orStream(streamBody=true) - Invoke processor — pass exchange to the downstream pipeline
- Post-process —
Noop(leave in place) /Delete/MoveTo - Confirm — mark idempotent key, delete done file
On processing failure: remove idempotent key, move to moveFailed directory (if configured).
Producer Pipeline
The GenericFileProducer writes files with atomic temp-then-rename:
- Resolve body — from
exchange.Out(if set) orexchange.In - Resolve target path — from
FileNameoption / header / auto-generated GUID - Validate path — jail-directory check (transport-specific)
- Create directories — if
autoCreate=true - Write to temp file — using
tempPrefixortempFileName - Handle existing — apply
fileExiststrategy (Override / Append / Fail / Ignore / Move / TryRename) - Atomic rename — move temp file to target
- Cleanup — delete temp file on failure
Options Reference
GenericFileEndpointOptions (Base)
Consumer / Polling
| Property | Type | Default | Description |
|---|---|---|---|
Delay |
int |
500 |
Poll interval (ms) |
InitialDelay |
int |
0 |
Delay before first poll (ms) |
Include |
string? |
— | Glob include pattern (*.csv,*.xml) |
Exclude |
string? |
— | Glob exclude pattern |
Recursive |
bool |
false |
Recurse subdirectories |
MaxDepth |
int |
0 |
Max recursion depth (0 = unlimited) |
MinDepth |
int |
0 |
Min depth for file selection |
SortBy |
GenericFileSortBy |
None |
Sort: Name, NameDesc, Modified, ModifiedDesc, Size, SizeDesc |
MaxMessagesPerPoll |
int |
0 |
Max files per poll (0 = unlimited) |
MinAge |
long |
0 |
Min file age (ms) |
Consumer / Post-Processing
| Property | Type | Default | Description |
|---|---|---|---|
Noop |
bool |
false |
Leave file in place after processing |
Delete |
bool |
false |
Delete file after processing |
MoveTo |
DynamicValue<string>? |
— | Move after processing (expression) |
MoveExisting |
GenericFileExistStrategy |
Override |
Strategy at move target |
PreMove |
DynamicValue<string>? |
— | Move before processing |
Only one of Noop, Delete, MoveTo can be set.
Consumer / Idempotency
| Property | Type | Default | Description |
|---|---|---|---|
Idempotent |
bool |
false |
Enable idempotent consumer |
IdempotentKey |
DynamicValue<string>? |
— | Custom key expression |
DoneFileName |
DynamicValue<string>? |
— | Done-file pattern (${file:name}.done) |
Default idempotent key: "{fullPath}|{lastModifiedUtc:O}|{length}".
Consumer / Body
| Property | Type | Default | Description |
|---|---|---|---|
StreamBody |
bool |
false |
false → byte[], true → Stream |
Charset |
string |
utf-8 |
Character encoding |
Producer
| Property | Type | Default | Description |
|---|---|---|---|
FileName |
DynamicValue<string>? |
— | Target file name (expression) |
FileExist |
GenericFileExistStrategy |
Override |
Override, Append, Fail, Ignore, Move, TryRename |
TempPrefix |
DynamicValue<string>? |
— | Temp file prefix |
TempFileName |
DynamicValue<string>? |
— | Full temp file name |
AutoCreate |
bool |
true |
Auto-create parent directories |
AllowNullBody |
bool |
false |
Allow null body (empty file) |
EagerDeleteTargetFile |
bool |
true |
Delete target before writing |
AppendChars |
string? |
— | Chars appended after each write |
RemoteFileEndpointOptions (extends Base)
Connection
| Property | Type | Default | Description |
|---|---|---|---|
Host |
string |
localhost |
Server hostname |
Port |
int |
(transport-specific) | Server port |
Username |
string? |
— | Auth username |
Password |
string? |
— | Auth password |
ConnectionTimeout |
int |
30000 |
Connection timeout (ms) |
OperationTimeout |
int |
60000 |
Operation timeout (ms) |
Reconnection
| Property | Type | Default | Description |
|---|---|---|---|
MaximumReconnectAttempts |
int |
3 |
Max reconnect attempts on failure |
ReconnectDelay |
int |
1000 |
Delay between attempts (ms) |
Disconnect |
bool |
false |
Disconnect after each poll/write |
Consumer-Specific
| Property | Type | Default | Description |
|---|---|---|---|
MaxAge |
long |
0 |
Max file age (ms, 0 = unlimited) |
MoveFailed |
DynamicValue<string>? |
— | Move on failure (expression) |
StartingDirectoryMustExist |
bool |
false |
Fail if base dir doesn't exist |
SendEmptyMessageWhenIdle |
bool |
false |
Send empty exchange when no files |
Enums
GenericFileExistStrategy
| Value | Description |
|---|---|
Override |
Overwrite existing file |
Append |
Append to existing file |
Fail |
Throw exception |
Ignore |
Skip silently |
Move |
Rename existing file before writing |
TryRename |
Try alternate names |
GenericFileSortBy
| Value | Description |
|---|---|
None |
No sorting |
Name / NameDesc |
Sort by name |
Modified / ModifiedDesc |
Sort by last modified |
Size / SizeDesc |
Sort by size |
File Operations Interface
Transport implementations provide IFileOperations (or IRemoteFileOperations for network transports):
ListFilesAsync— enumerate files in a directoryReadAllBytesAsync/OpenReadAsync— read file contentsWriteAsync(byte[] / Stream) /AppendAsync/AppendTextAsync— writeExistsAsync/DeleteAsync/MoveAsync— file operationsCreateDirectoryAsync/DirectoryExistsAsync— directory operations- Path helpers:
CombinePath,GetParentPath,GetFileName,GetExtension, etc.
Glob Patterns
Include/exclude patterns support comma-separated values and */? wildcards:
*.csv — all CSV files
*.csv,*.xml — CSV and XML files
report_* — files starting with "report_"
data?.txt — data1.txt, dataA.txt, etc.
Done File Substitutions
| Variable | Description |
|---|---|
${file:name} |
Full file name with extension |
${file:name.noext} |
File name without extension |
Requirements
- .NET 8.0 / 9.0 / 10.0
redb.Route(core) — no external dependencies
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- redb.Route (>= 2.0.2)
-
net8.0
- redb.Route (>= 2.0.2)
-
net9.0
- redb.Route (>= 2.0.2)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on redb.Route.GenericFile:
| Package | Downloads |
|---|---|
|
redb.Route.Sftp
SFTP transport for redb.Route ESB framework. Polling consumer and atomic producer with SSH.NET — key/password auth, proxy, idempotency, glob filtering, temp-file upload, chmod, recursive directories. |
|
|
redb.Route.Ftp
FTP/FTPS transport for redb.Route ESB framework. Polling consumer and atomic producer with FluentFTP — passive/active mode, TLS, glob filtering, idempotency, temp-file upload, recursive directories. |
|
|
redb.Route.File
File system transport for redb.Route ESB framework. Provides polling consumer and atomic file producer with locking, idempotency, and glob filtering. |
GitHub repositories
This package is not used by any popular GitHub repositories.