ExecuteStreamCommand in Data-Integration Processors

Executes an external command on the contents of a flow file, and creates a new flow file with the results of the command.

Tags:

command execution, command, stream, execute

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
Character Set UTF-8 The Character Set in which the file is encoded
Maximum Capture Group Length 1024 Specifies the maximum number of characters a given capture group value can have. Any characters beyond the max will be truncated.
Working Directory The directory to use as the current working directory when executing the command
Supports Expression Language: true
Enable Case-insensitive Matching false * true
* false
Indicates that two characters match even if they are in a different case. Can also be specified via the embeded flag (?i).
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'. The value of this property will be the key for the output attribute.
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.

Dynamic Properties:

Dynamic Properties allow the user to specify both the name and value of a property.

Name Value Description
An environment variable name An environment variable value These environment variables are passed to the process spawned by this Processor

Relationships:

Name Description
original FlowFiles that were successfully processed
output stream The destination path for the flow file created from the command's output

Reads Attributes:

None specified.

Writes Attributes:

Name Description
execution.command The name of the command executed
execution.command.args The semi-colon delimited list of arguments
execution.status The exit status code returned from executing the command
execution.error Any error messages returned from executing the command

How to configure?

Step 1: Drag and drop the ExecuteStreamCommand processor to canvas.

Step 2: Double click the processor to configure, the configuration dialog will be opened as follows,

Data Integration Processors Execute Stream Command

Step 3: Check usage of each property and update those values.

Properties and usage

Command Arguments: Enters the arguments separated by ‘;’ which is used for executing the exe.

Command Path: Enters the command to be executed here.

Ignore STDIN: It is used to avoid sending incoming flow files to the executing command.

Working Directory: Specifies the directory to be used as working directory when executing the command.

Argument Delimiter: Specifies the delimiter used to separate arguments for the command.

Output Destination Attribute: It sends the output stream as flow file attribute of incoming flow file instead of separate flow file. If this property is set, output stream relationship would not be available. The value of this property will be the name of the flow file attribute.

Max Attribute Length: It is used to specify the maximum length of the attribute while setting output destination attribute property. If the length of the output is greater than the given max length, then the output will be truncated.

For example, if you want to execute an exe which is used to add two numbers. You should configure the ExecuteStreamCommand processor as below,

Command Arguments: 5,78
Argument Delimiter: , (Comma)


Data Integration Processors Command Arguments