Class ExecuteStreamCommand
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.ExecuteStreamCommand
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SupportsBatching
@InputRequirement(INPUT_REQUIRED)
@Tags({"command execution","command","stream","execute"})
@CapabilityDescription("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.")
@SupportsSensitiveDynamicProperties
@DynamicProperty(name="An environment variable name",value="An environment variable value",description="These environment variables are passed to the process spawned by this Processor") @DynamicProperty(name="command.argument.<commandIndex>",value="Argument to be supplied to the command",description="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.")
@WritesAttribute(attribute="execution.command",description="The name of the command executed") @WritesAttribute(attribute="execution.command.args",description="The semi-colon delimited list of arguments. Sensitive properties will be masked") @WritesAttribute(attribute="execution.status",description="The exit status code returned from executing the command") @WritesAttribute(attribute="execution.error",description="Any error messages returned from executing the command") @WritesAttribute(attribute="mime.type",description="Sets the MIME type of the output if the \'Output MIME Type\' property is set and \'Output Destination Attribute\' is not set")
@Restricted(restrictions=@Restriction(requiredPermission=EXECUTE_CODE,explanation="Provides operator the ability to execute arbitrary code assuming all permissions that NiFi has."))
public class ExecuteStreamCommand
extends org.apache.nifi.processor.AbstractProcessor
This processor executes an external command on the contents of a flow file, and creates a new flow file with the results of the command.
Properties:
- 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.
- Default value: none
- Supports expression language: true
- Arguments Strategy
- Selects the strategy to use for arguments to the executable
- Command Arguments Property: Use the delimited list of arguments from the Command Arguments Property. Does not support quotations in parameters.
- Dynamic Property Arguments: Use Dynamic Properties, with each property a separate argument. Does support quotes.
- Command Arguments
- The arguments to supply to the executable delimited by the ';' character. Each argument may be an Expression Language statement.
- Default value: none
- Supports expression language: true
- Working Directory
- The directory to use as the current working directory when executing the command
- Default value: none (which means whatever NiFi's current working directory is...probably the root of the NiFi installation directory.)
- Supports expression language: true
- Ignore STDIN
- Indicates whether or not the flowfile's contents should be streamed as part of STDIN
- Default value: false (this means that the contents of a flowfile will be sent as STDIN to your command
- Supports expression language: false
Relationships:
- original
- The destination path for the original incoming flow file
- output-stream
- The destination path for the flow file created from the command's output, if the exit code is zero
- nonzero-status
- The destination path for the flow file created from the command's output, if the exit code is non-zero
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate static final org.apache.nifi.components.Validatorprivate static final Set<org.apache.nifi.processor.Relationship> private static final Pattern(package private) static final org.apache.nifi.components.AllowableValue(package private) static final org.apache.nifi.components.AllowableValue(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate org.apache.nifi.logging.ComponentLogprivate static final String(package private) static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.processor.Relationshipstatic final org.apache.nifi.processor.Relationshipstatic final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> private static final List<org.apache.nifi.components.PropertyDescriptor> (package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate final AtomicReference<Set<org.apache.nifi.processor.Relationship>> (package private) static final org.apache.nifi.components.PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSet<org.apache.nifi.processor.Relationship> protected org.apache.nifi.components.PropertyDescriptorgetSupportedDynamicPropertyDescriptor(String propertyDescriptorName) List<org.apache.nifi.components.PropertyDescriptor> protected voidinit(org.apache.nifi.processor.ProcessorInitializationContext context) voidonPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) private static voidreadStdoutReadable(boolean ignoreStdin, OutputStream stdinWritable, org.apache.nifi.logging.ComponentLog logger, InputStream incomingFlowFileIS) Methods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
ORIGINAL_RELATIONSHIP
public static final org.apache.nifi.processor.Relationship ORIGINAL_RELATIONSHIP -
OUTPUT_STREAM_RELATIONSHIP
public static final org.apache.nifi.processor.Relationship OUTPUT_STREAM_RELATIONSHIP -
NONZERO_STATUS_RELATIONSHIP
public static final org.apache.nifi.processor.Relationship NONZERO_STATUS_RELATIONSHIP -
relationships
-
OUTPUT_STREAM_RELATIONSHIP_SET
-
ATTRIBUTE_RELATIONSHIP_SET
-
COMMAND_ARGUMENT_PATTERN
-
COMMAND_ARGUMENTS_PROPERTY_STRATEGY
static final org.apache.nifi.components.AllowableValue COMMAND_ARGUMENTS_PROPERTY_STRATEGY -
DYNAMIC_PROPERTY_ARGUMENTS_STRATEGY
static final org.apache.nifi.components.AllowableValue DYNAMIC_PROPERTY_ARGUMENTS_STRATEGY -
WORKING_DIR
static final org.apache.nifi.components.PropertyDescriptor WORKING_DIR -
ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR
private static final org.apache.nifi.components.Validator ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR -
EXECUTION_COMMAND
static final org.apache.nifi.components.PropertyDescriptor EXECUTION_COMMAND -
ARGUMENTS_STRATEGY
static final org.apache.nifi.components.PropertyDescriptor ARGUMENTS_STRATEGY -
EXECUTION_ARGUMENTS
static final org.apache.nifi.components.PropertyDescriptor EXECUTION_ARGUMENTS -
ARG_DELIMITER
static final org.apache.nifi.components.PropertyDescriptor ARG_DELIMITER -
IGNORE_STDIN
static final org.apache.nifi.components.PropertyDescriptor IGNORE_STDIN -
PUT_OUTPUT_IN_ATTRIBUTE
static final org.apache.nifi.components.PropertyDescriptor PUT_OUTPUT_IN_ATTRIBUTE -
PUT_ATTRIBUTE_MAX_LENGTH
static final org.apache.nifi.components.PropertyDescriptor PUT_ATTRIBUTE_MAX_LENGTH -
MIME_TYPE
static final org.apache.nifi.components.PropertyDescriptor MIME_TYPE -
PROPERTY_DESCRIPTORS
-
MASKED_ARGUMENT
- See Also:
-
logger
private org.apache.nifi.logging.ComponentLog logger
-
-
Constructor Details
-
ExecuteStreamCommand
public ExecuteStreamCommand()
-
-
Method Details
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
init
protected void init(org.apache.nifi.processor.ProcessorInitializationContext context) - Overrides:
initin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
onPropertyModified
public void onPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) - Specified by:
onPropertyModifiedin interfaceorg.apache.nifi.components.ConfigurableComponent- Overrides:
onPropertyModifiedin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getSupportedDynamicPropertyDescriptor
protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) - Overrides:
getSupportedDynamicPropertyDescriptorin classorg.apache.nifi.components.AbstractConfigurableComponent
-
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
readStdoutReadable
private static void readStdoutReadable(boolean ignoreStdin, OutputStream stdinWritable, org.apache.nifi.logging.ComponentLog logger, InputStream incomingFlowFileIS)
-