Package org.apache.camel.component.exec
Class ExecEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.exec.ExecEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasId,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.3.0",
scheme="exec",
title="Exec",
syntax="exec:executable",
producerOnly=true,
category=SYSTEM,
headersClass=ExecBinding.class)
public class ExecEndpoint
extends org.apache.camel.support.DefaultEndpoint
Execute commands on the underlying operating system.
-
Field Summary
FieldsFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.ProducergetArgs()org.apache.camel.LoggingLevellongbooleanvoidThe arguments may be one or many whitespace-separated tokens.voidsetBinding(ExecBinding binding) A reference to a org.apache.commons.exec.ExecBinding in the Registry.voidsetCommandExecutor(ExecCommandExecutor commandExecutor) A reference to a org.apache.commons.exec.ExecCommandExecutor in the Registry that customizes the command execution.voidsetCommandLogLevel(org.apache.camel.LoggingLevel commandLogLevel) Logging level to be used for commands during execution.voidsetExecutable(String executable) Sets the executable to be executed.voidsetExitValues(String exitValues) The exit values of successful executions.voidsetOutFile(String outFile) The name of a file, created by the executable, that should be considered as its output.voidsetTimeout(long timeout) The timeout, in milliseconds, after which the executable should be terminated.voidsetUseStderrOnEmptyStdout(boolean useStderrOnEmptyStdout) A boolean indicating that when stdout is empty, this component will populate the Camel Message Body with stderr.voidsetWorkingDir(String dir) The directory in which the command should be executed.Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, doStart, doStop, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducerMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
NO_TIMEOUT
public static final long NO_TIMEOUTIndicates that notimeoutis used.- See Also:
-
-
Constructor Details
-
ExecEndpoint
-
-
Method Details
-
createProducer
- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Throws:
Exception
-
getExecutable
-
setExecutable
Sets the executable to be executed. The executable must not be empty ornull. -
getArgs
-
setArgs
The arguments may be one or many whitespace-separated tokens. -
getWorkingDir
-
setWorkingDir
The directory in which the command should be executed. If null, the working directory of the current process will be used. -
getTimeout
public long getTimeout() -
setTimeout
public void setTimeout(long timeout) The timeout, in milliseconds, after which the executable should be terminated. If execution has not completed within the timeout, the component will send a termination request. -
getExitValues
-
setExitValues
The exit values of successful executions. If the process exits with another value, an exception is raised. Comma-separated list of exit values. And empty list (the default) sets no expected exit values and disables the check. -
getOutFile
-
setOutFile
The name of a file, created by the executable, that should be considered as its output. If no outFile is set, the standard output (stdout) of the executable will be used instead. -
getCommandExecutor
-
setCommandExecutor
A reference to a org.apache.commons.exec.ExecCommandExecutor in the Registry that customizes the command execution. The default command executor utilizes the commons-exec library, which adds a shutdown hook for every executed command. -
getBinding
-
setBinding
A reference to a org.apache.commons.exec.ExecBinding in the Registry. -
isUseStderrOnEmptyStdout
public boolean isUseStderrOnEmptyStdout() -
setUseStderrOnEmptyStdout
public void setUseStderrOnEmptyStdout(boolean useStderrOnEmptyStdout) A boolean indicating that when stdout is empty, this component will populate the Camel Message Body with stderr. This behavior is disabled (false) by default. -
getCommandLogLevel
public org.apache.camel.LoggingLevel getCommandLogLevel() -
setCommandLogLevel
public void setCommandLogLevel(org.apache.camel.LoggingLevel commandLogLevel) Logging level to be used for commands during execution. The default value is DEBUG. Possible values are TRACE, DEBUG, INFO, WARN, ERROR or OFF. (Values of ExecCommandLogLevelType enum)
-