ExecuteStreamCommand
Description
The ExecuteStreamCommand processor provides a flexible way to integrate external commands and scripts into NiFi data flows. ExecuteStreamCommand can pass the incoming FlowFile's content to the command that it executes similarly how piping works.
Tags
command, command execution, execute, stream
Properties
In the list below required Properties are shown with an asterisk (*). Other properties are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.
Display Name | API Name | Default Value | Allowable Values | Description |
---|---|---|---|---|
Working Directory | Working Directory | The directory to use as the current working directory when executing the command Supports Expression Language, using FlowFile attributes and Environment variables. | ||
Command Path * | Command Path | Specifies the command to be executed; if just the name of an executable is provided, it must be in the user's environment PATH. Supports Expression Language, using FlowFile attributes and Environment variables. | ||
Command Arguments Strategy | argumentsStrategy | Command Arguments Property |
| Strategy for configuring arguments to be supplied to the command. |
Command Arguments | Command Arguments | The arguments to supply to the executable delimited by the ';' character. Supports Expression Language, using FlowFile attributes and Environment variables. This property is only considered if:
| ||
Argument Delimiter * | Argument Delimiter | ; | Delimiter to use to separate arguments for a command [default: ;]. Must be a single character This property is only considered if:
| |
Ignore STDIN | Ignore STDIN | false |
| If true, the contents of the incoming flowfile will not be passed to the executing command |
Output Destination Attribute | Output Destination Attribute | If set, the output of the stream command will be put into an attribute of the original FlowFile instead of a separate FlowFile. There will no longer be a relationship for 'output stream' or 'nonzero status'. The value of this property will be the key for the output attribute. | ||
Max Attribute Length | Max Attribute Length | 256 | If routing the output of the stream command to an attribute, the number of characters put to the attribute value will be at most this amount. This is important because attributes are held in memory and large attributes will quickly cause out of memory issues. If the output goes longer than this value, it will truncated to fit. Consider making this smaller if able. | |
Output MIME Type | Output MIME Type | Specifies the value to set for the "mime.type" attribute. This property is ignored if 'Output Destination Attribute' is set. |
Dynamic Properties
Name | Value | Description |
---|---|---|
An environment variable name | An environment variable value | These environment variables are passed to the process spawned by this Processor Supports Expression Language: No |
command.argument.<commandIndex> | Argument to be supplied to the command | These arguments are supplied to the process spawned by this Processor when using the Command Arguments Strategy : Dynamic Property Arguments. <commandIndex> is a number and it will determine the order. Supports Expression Language: No |
Relationships
Name | Description |
---|---|
nonzero status | The destination path for the flow file created from the command's output, if the returned status code is non-zero. All flow files routed to this relationship will be penalized. |
original | The original FlowFile will be routed. It will have new attributes detailing the result of the script execution. |
output stream | The destination path for the flow file created from the command's output, if the returned status code is zero. |
Reads Attributes
This processor does not read attributes.
Writes Attributes
Name | Description |
---|---|
execution.command | The name of the command executed |
execution.command.args | The semi-colon delimited list of arguments. Sensitive properties will be masked |
execution.error | Any error messages returned from executing the command |
execution.status | The exit status code returned from executing the command |
mime.type | Sets the MIME type of the output if the 'Output MIME Type' property is set and 'Output Destination Attribute' is not set |
State Management
This component does not store state.
Restricted
Required Permission | Explanation |
---|---|
execute code | Provides operator the ability to execute arbitrary code assuming all permissions that NiFi has. |
Input Requirement
This component requires an incoming relationship.
System Resource Considerations
This component does not specify system resource considerations.