@EventDriven @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"command execution","command","stream","execute"}) @CapabilityDescription(value="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") @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 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:
Relationships:
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
ExecuteStreamCommand.ProcessStreamWriterCallback |
| Constructor and Description |
|---|
ExecuteStreamCommand() |
| Modifier and Type | Method and Description |
|---|---|
Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onPropertyModified(PropertyDescriptor descriptor,
String oldValue,
String newValue) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
private static void |
readStdoutReadable(boolean ignoreStdin,
OutputStream stdinWritable,
ComponentLog logger,
InputStream incomingFlowFileIS) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTruecustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, validatepublic static final Relationship ORIGINAL_RELATIONSHIP
public static final Relationship OUTPUT_STREAM_RELATIONSHIP
public static final Relationship NONZERO_STATUS_RELATIONSHIP
private final AtomicReference<Set<Relationship>> relationships
private static final Set<Relationship> OUTPUT_STREAM_RELATIONSHIP_SET
private static final Set<Relationship> ATTRIBUTE_RELATIONSHIP_SET
private static final Pattern COMMAND_ARGUMENT_PATTERN
static final AllowableValue COMMAND_ARGUMENTS_PROPERTY_STRATEGY
static final AllowableValue DYNAMIC_PROPERTY_ARGUMENTS_STRATEGY
static final PropertyDescriptor WORKING_DIR
private static final Validator ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR
static final PropertyDescriptor EXECUTION_COMMAND
static final PropertyDescriptor ARGUMENTS_STRATEGY
static final PropertyDescriptor EXECUTION_ARGUMENTS
static final PropertyDescriptor ARG_DELIMITER
static final PropertyDescriptor IGNORE_STDIN
static final PropertyDescriptor PUT_OUTPUT_IN_ATTRIBUTE
static final PropertyDescriptor PUT_ATTRIBUTE_MAX_LENGTH
private static final List<PropertyDescriptor> PROPERTIES
private static final String MASKED_ARGUMENT
private ComponentLog logger
public Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorpublic void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified in interface ConfigurableComponentonPropertyModified in class AbstractConfigurableComponentpublic List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentpublic void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprivate static void readStdoutReadable(boolean ignoreStdin,
OutputStream stdinWritable,
ComponentLog logger,
InputStream incomingFlowFileIS)
Copyright © 2023 Apache NiFi Project. All rights reserved.