@InputRequirement(value=INPUT_FORBIDDEN) @Tags(value={"command","process","source","external","invoke","script"}) @CapabilityDescription(value="Runs an operating system command specified by the user and writes the output of that command to a FlowFile. If the command is expected to be long-running, the Processor can output the partial data on a specified interval. When this option is used, the output is expected to be in textual format, as it typically does not make sense to split binary data on arbitrary time-based intervals.") @DynamicProperty(name="An environment variable name", value="An environment variable value", description="These environment variables are passed to the process spawned by this Processor") @Restricted(restrictions=@Restriction(requiredPermission=EXECUTE_CODE,explanation="Provides operator the ability to execute arbitrary code assuming all permissions that NiFi has.")) @WritesAttribute(attribute="command",description="Executed command") @WritesAttribute(attribute="command.arguments",description="Arguments of the command") public class ExecuteProcess extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
private static class |
ExecuteProcess.ProxyOutputStream
Output stream that is used to wrap another output stream in a way that the underlying output stream can be swapped out for a different one when needed
|
Modifier and Type | Field and Description |
---|---|
(package private) static PropertyDescriptor |
ARG_DELIMITER |
(package private) static String |
ATTRIBUTE_COMMAND |
(package private) static String |
ATTRIBUTE_COMMAND_ARGS |
static PropertyDescriptor |
BATCH_DURATION |
private static Validator |
characterValidator |
static PropertyDescriptor |
COMMAND |
static PropertyDescriptor |
COMMAND_ARGUMENTS |
private ExecutorService |
executor |
private Process |
externalProcess |
private AtomicBoolean |
failure |
private Future<?> |
longRunningProcess |
private ExecuteProcess.ProxyOutputStream |
proxyOut |
static PropertyDescriptor |
REDIRECT_ERROR_STREAM |
static Relationship |
REL_SUCCESS |
static PropertyDescriptor |
WORKING_DIR |
Constructor and Description |
---|
ExecuteProcess() |
Modifier and Type | Method and Description |
---|---|
protected List<String> |
createCommandStrings(ProcessContext context,
String command,
String arguments) |
Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected Future<?> |
launchProcess(ProcessContext context,
List<String> commandStrings,
Long batchNanos,
ExecuteProcess.ProxyOutputStream proxyOut) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
void |
setupExecutor(ProcessContext context) |
void |
shutdownExecutor() |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isStateful
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
static final String ATTRIBUTE_COMMAND
static final String ATTRIBUTE_COMMAND_ARGS
public static final PropertyDescriptor COMMAND
public static final PropertyDescriptor COMMAND_ARGUMENTS
public static final PropertyDescriptor WORKING_DIR
public static final PropertyDescriptor BATCH_DURATION
public static final PropertyDescriptor REDIRECT_ERROR_STREAM
private static final Validator characterValidator
static final PropertyDescriptor ARG_DELIMITER
public static final Relationship REL_SUCCESS
private volatile Process externalProcess
private volatile ExecutorService executor
private Future<?> longRunningProcess
private AtomicBoolean failure
private volatile ExecuteProcess.ProxyOutputStream proxyOut
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor
in class AbstractConfigurableComponent
@OnScheduled public void setupExecutor(ProcessContext context)
@OnUnscheduled public void shutdownExecutor()
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
protected List<String> createCommandStrings(ProcessContext context, String command, String arguments)
protected Future<?> launchProcess(ProcessContext context, List<String> commandStrings, Long batchNanos, ExecuteProcess.ProxyOutputStream proxyOut) throws IOException
IOException
Copyright © 2022 Apache NiFi Project. All rights reserved.