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.ComponentAware
,org.apache.camel.Endpoint
,org.apache.camel.IsSingleton
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.HasCamelContext
,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=CORE,
headersClass=ExecBinding.class)
public class ExecEndpoint
extends org.apache.camel.support.DefaultEndpoint
Execute commands on the underlying operating system.
-
Field Summary
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Consumer
createConsumer
(org.apache.camel.Processor processor) org.apache.camel.Producer
getArgs()
org.apache.camel.LoggingLevel
long
boolean
void
The arguments may be one or many whitespace-separated tokens.void
setBinding
(ExecBinding binding) A reference to a org.apache.commons.exec.ExecBinding in the Registry.void
setCommandExecutor
(ExecCommandExecutor commandExecutor) A reference to a org.apache.commons.exec.ExecCommandExecutor in the Registry that customizes the command execution.void
setCommandLogLevel
(org.apache.camel.LoggingLevel commandLogLevel) Logging level to be used for commands during execution.void
setExecutable
(String executable) Sets the executable to be executed.void
setExitValues
(String exitValues) The exit values of successful executions.void
setOutFile
(String outFile) The name of a file, created by the executable, that should be considered as its output.void
setTimeout
(long timeout) The timeout, in milliseconds, after which the executable should be terminated.void
setUseStderrOnEmptyStdout
(boolean useStderrOnEmptyStdout) A boolean indicating that when stdout is empty, this component will populate the Camel Message Body with stderr.void
setWorkingDir
(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, 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, toString
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.camel.ComponentAware
getComponent
Methods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducer
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
NO_TIMEOUT
public static final long NO_TIMEOUTIndicates that notimeout
is 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)
-