pub struct FileConfig {Show 29 fields
pub directory: String,
pub delay: Duration,
pub initial_delay: Duration,
pub noop: bool,
pub delete: bool,
pub file_name: Option<String>,
pub include: Option<String>,
pub exclude: Option<String>,
pub ant_include: Option<String>,
pub ant_exclude: Option<String>,
pub include_ext: Option<String>,
pub exclude_ext: Option<String>,
pub recursive: bool,
pub file_exist: FileExistStrategy,
pub read_lock_strategy: ReadLockStrategy,
pub idempotent_key: IdempotentKey,
pub done_file_name: Option<String>,
pub charset: Option<String>,
pub temp_prefix: Option<String>,
pub durable: bool,
pub auto_create: bool,
pub starting_directory_must_exist: bool,
pub read_timeout: Duration,
pub write_timeout: Duration,
pub max_depth: usize,
pub min_depth: usize,
pub max_messages_per_poll: i64,
pub eager_max_messages_per_poll: bool,
pub shuffle: bool,
/* private fields */
}Expand description
Configuration for file component endpoints.
§Streaming
Both the file consumer and producer use native streaming with no RAM materialization:
-
The consumer creates a
Body::Streambacked bytokio::fs::FileviaReaderStream. Files of any size are handled without loading them into memory. -
The producer writes via
tokio::io::copydirectly to atokio::fs::FileusingBody::into_async_read(). Writes for theOverridestrategy are atomic: data is written to a temporary file first and renamed only on success, preventing partial files on failure.
§Write strategies (fileExist URI parameter)
| Value | Behavior |
|---|---|
Override (default) | Atomic write via temp file + rename |
Append | Appends to existing file; non-atomic by nature |
Fail | Returns error if file already exists |
Ignore | Skip write if file already exists |
Fields§
§directory: StringDirectory path to read from or write to.
delay: DurationPolling delay as Duration.
initial_delay: DurationInitial delay as Duration.
noop: boolIf true, don’t delete or move files after processing.
delete: boolIf true, delete files after processing.
file_name: Option<String>Fixed filename for producer (optional).
include: Option<String>Regex pattern for including files (consumer).
exclude: Option<String>Regex pattern for excluding files (consumer).
ant_include: Option<String>Ant-style include pattern (comma-separated).
ant_exclude: Option<String>Ant-style exclude pattern (comma-separated).
include_ext: Option<String>File extensions to include (comma-separated).
exclude_ext: Option<String>File extensions to exclude (comma-separated).
recursive: boolWhether to scan directories recursively.
file_exist: FileExistStrategyStrategy for handling existing files when writing.
read_lock_strategy: ReadLockStrategyRead lock strategy for concurrent consumers.
idempotent_key: IdempotentKeyIn-memory idempotent key selector for consumer.
done_file_name: Option<String>Done marker filename pattern created after successful write.
charset: Option<String>Charset for string body encoding (UTF-8, ISO-8859-1).
temp_prefix: Option<String>Prefix for temporary files during atomic writes.
durable: boolIf true, fsync temp file and parent directory after atomic write, in the
correct order (temp → rename → parent). Crash-safe but slower. Opt-in via
?durable=true. Default false (preserves current latency characteristics).
auto_create: boolWhether to automatically create directories.
starting_directory_must_exist: boolIf true, verify the starting directory exists at startup.
read_timeout: DurationRead timeout as Duration.
write_timeout: DurationWrite timeout as Duration.
max_depth: usize§min_depth: usize§max_messages_per_poll: i64§eager_max_messages_per_poll: bool§shuffle: boolImplementations§
Source§impl FileConfig
impl FileConfig
Sourcepub fn apply_global_defaults(&mut self, global: &FileGlobalConfig)
pub fn apply_global_defaults(&mut self, global: &FileGlobalConfig)
Apply global config defaults. Since FileConfig uses a proc macro that bakes in defaults, we compare Duration values against the known macro defaults to detect “not explicitly set by user”. Only overrides when current value == macro default.
Note: If a user explicitly sets a URI param to its default value (e.g.,
?delay=500), it is indistinguishable from “not set” and will be overridden
by global config. This is a known limitation of the Duration comparison approach.
Trait Implementations§
Source§impl Clone for FileConfig
impl Clone for FileConfig
Source§fn clone(&self) -> FileConfig
fn clone(&self) -> FileConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more