Class FileConsumer
File consumer. Inherits the complete poll loop from
and adds local-file-specific behavior: read locking, lock-file exclusion, content-type inference.
public class FileConsumer : GenericFileConsumer<FileEndpointOptions>, IConsumer
Inheritance
Implements
Inherited Members
Properties
BasePath
Base path for file operations (directory for local, remote path for SFTP/FTP).
protected override string BasePath { get; }
ConsumerName
Display name for logging (e.g. "kafka:orders", "file:/tmp/in").
protected override string ConsumerName { get; }
Methods
AcquireReadLockAsync(GenericFileInfo, CancellationToken)
Acquires a read lock on the file before processing. Returns true if lock was acquired.
protected override Task<bool> AcquireReadLockAsync(GenericFileInfo file, CancellationToken ct)
ApplyFilters(IEnumerable<GenericFileInfo>)
Applies Include/Exclude glob filters and excludes internal temp files.
protected override IEnumerable<GenericFileInfo> ApplyFilters(IEnumerable<GenericFileInfo> files)
CreateExchangeAsync(GenericFileInfo, string, CancellationToken)
Creates an exchange with the file body and protocol-specific headers.
protected override Task<Exchange> CreateExchangeAsync(GenericFileInfo file, string workPath, CancellationToken ct)
OnProcessingFailedAsync(GenericFileInfo, string, CancellationToken)
Called when processing fails (exchange.Exception is set and not handled). Override in a connector to move the
protected override Task OnProcessingFailedAsync(GenericFileInfo file, string workPath, CancellationToken ct)
OnProcessingFailedAsync(string, string, string, CancellationToken)
The compatibility form of . A
protected override Task OnProcessingFailedAsync(string filePath, string fileName, string basePath, CancellationToken ct)
ReleaseReadLockAsync(GenericFileInfo, CancellationToken)
Releases the read lock after processing. Override in local file consumer.
protected override Task ReleaseReadLockAsync(GenericFileInfo file, CancellationToken ct)
ResolveWorkPath(GenericFileInfo)
Path the file occupies once the read lock is held. Called after
protected override string ResolveWorkPath(GenericFileInfo file)
SetExchangeHeaders(IMessage, GenericFileInfo, string)
Sets protocol-specific headers on the exchange message.
protected override void SetExchangeHeaders(IMessage message, GenericFileInfo file, string workPath)
Constructors
FileConsumer(FileEndpoint, IProcessor, FileEndpointOptions)
Creates a file consumer.