FetchFile in Data Integration Processor
Reads the contents of a file from disk and streams it into the contents of an incoming FlowFile. Once this is done, the file is optionally moved elsewhere or deleted to help keep the file system organized.
Tags:
local, files, filesystem, ingest, ingress, get, source, input
Properties:
In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the Expression Language Guide.
Name | Default Value | Allowable Values | Description |
File to Fetch | ${absolute.path}/${filename} |
The fully-qualified filename of the file to fetch from the file system Supports Expression Language: true |
|
Completion Strategy | None |
* None ![]() ![]() ![]() |
Specifies what to do with the original file on the file system once it has been pulled into NiFi |
Move Destination Directory |
The directory to the move the original file to once it has been fetched from the file system. This property is ignored unless the Completion Strategy is set to "Move File". If the directory does not exist, it will be created. Supports Expression Language: true |
||
Move Conflict Strategy | Rename |
*Rename![]() ![]() ![]() ![]() |
If Completion Strategy is set to Move File and a file already exists in the destination directory with the same name, this property specifies how that naming conflict should be resolved |
Relationships:
Name | Description |
not.found | Any FlowFile that could not be fetched from the file system because the file could not be found will be transferred to this Relationship. |
failure | Any FlowFile that could not be fetched from the file system for any reason other than insufficient permissions or the file not existing will be transferred to this Relationship. |
permission.denied | Any FlowFile that could not be fetched from the file system due to the user running NiFi not having sufficient permissions will be transferred to this Relationship. |
success | Any FlowFile that is successfully fetched from the file system will be transferred to this Relationship. |
Reads Attributes:
None specified.
Writes Attributes:
None specified.
How to configure?
Step 1: Drag and drop the FetchFile processor to canvas.
Step 2: Double click the processor to configure, the configuration dialog will be opened as follows,
Step 3: Check usage of each property and update those values.
Properties and usage:
File to Fetch: Enters the fully-qualified filename of the file to be fetched.
Completion Strategy: Specifies the fetched file action.
- None
- Move File
- Delete File
Move Destination Directory: Enters the destination directory to move the original file after fetched. It will be considered only when completion strategy is set as move file.
Move Conflict Strategy: Specifies how to handle conflict when completion strategy is set as move file and file with the same name already exists.
- Rename
- Replace File
- Keep Existing
- Failure
Log level when file not found: Specifies the log level when specified file is not found.
Log level when permission denied: Specifies the log level when user does not have permission to access the file specified.
The following are the available log levels:
- Trace
- Debug
- Info
- Warn
- Error
- Fatal
- None
For example, to read the books.xml file and move to another folder, you should configure the FetchFile as follows,
See Also:
GetFile,PutFile,ListFile