public class ExecEndpoint
extends org.apache.camel.impl.DefaultEndpoint
ExecCommandExecutor
to execute a system
command when it receives message exchanges.ExecBinding
,
ExecCommandExecutor
,
ExecCommand
,
ExecResult
Modifier and Type | Field and Description |
---|---|
static long |
NO_TIMEOUT
Indicates that no
timeout is used. |
Constructor and Description |
---|
ExecEndpoint(String uri,
ExecComponent component) |
Modifier and Type | Method and Description |
---|---|
org.apache.camel.Consumer |
createConsumer(org.apache.camel.Processor processor) |
org.apache.camel.Producer |
createProducer() |
String |
getArgs()
The arguments may be one or many whitespace-separated tokens, that can be
quoted with ", e.g.
|
ExecBinding |
getBinding() |
ExecCommandExecutor |
getCommandExecutor() |
String |
getExecutable() |
String |
getOutFile() |
long |
getTimeout() |
String |
getWorkingDir() |
boolean |
isSingleton() |
boolean |
isUseStderrOnEmptyStdout() |
void |
setArgs(String args)
Sets the arguments of the executable application
|
void |
setBinding(ExecBinding binding) |
void |
setCommandExecutor(ExecCommandExecutor commandExecutor)
Sets a custom executor to execute commands.
|
void |
setExecutable(String executable)
Sets the executable to be executed.
|
void |
setOutFile(String outFile) |
void |
setTimeout(long timeout)
Sets the timeout.
|
void |
setUseStderrOnEmptyStdout(boolean useStderrOnEmptyStdout) |
void |
setWorkingDir(String dir)
Sets the working directory of the executable.
|
configureConsumer, configurePollingConsumer, configureProperties, createEndpointConfiguration, createEndpointUri, createExchange, createExchange, createExchange, createPollingConsumer, doStart, doStop, equals, getCamelContext, getComponent, getConsumerProperties, getEndpointConfiguration, getEndpointKey, getEndpointUri, getExchangePattern, getId, getPollingConsumerQueueSize, hashCode, isLenientProperties, isPollingConsumerBlockWhenFull, isSynchronous, setCamelContext, setConsumerProperties, setEndpointConfiguration, setEndpointUri, setEndpointUriIfNotSpecified, setExchangePattern, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
public static final long NO_TIMEOUT
timeout
is used.public ExecEndpoint(String uri, ExecComponent component)
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
Exception
public boolean isSingleton()
public String getExecutable()
ExecBinding.EXEC_COMMAND_EXECUTABLE
public void setExecutable(String executable)
null
.executable
- Sets the executable to be executed.public String getArgs()
args="arg 1" arg2"
will use two arguments
arg 1
and arg2
. To include the quotes use
""
args=""arg 1"" arg2
will use the arguments
"arg 1"
and arg2
.ExecBinding.EXEC_COMMAND_ARGS
,
ExecParseUtils.splitToWhiteSpaceSeparatedTokens(String)
public void setArgs(String args)
args
- Returns null
value if no arguments are
configured in the endpoint URIgetArgs()
,
ExecBinding.EXEC_COMMAND_ARGS
public String getWorkingDir()
null
is
such is not set.ExecBinding.EXEC_COMMAND_WORKING_DIR
public void setWorkingDir(String dir)
dir
- the working directory of the executable. null
values indicates that the current working directory will be
used.public long getTimeout()
long
. The
default value is NO_TIMEOUT
ExecBinding.EXEC_COMMAND_TIMEOUT
public void setTimeout(long timeout)
timeout
- The timeout
must be a positive longExecBinding.EXEC_COMMAND_TIMEOUT
public String getOutFile()
null
if no out file is set, otherwise returns the
value of the outFileExecBinding.EXEC_COMMAND_OUT_FILE
public void setOutFile(String outFile)
outFile
- a not-empty file pathExecBinding.EXEC_COMMAND_OUT_FILE
public ExecCommandExecutor getCommandExecutor()
DefaultExecCommandExecutor
public void setCommandExecutor(ExecCommandExecutor commandExecutor)
commandExecutor
- a not-null instance of ExecCommandExecutor
public ExecBinding getBinding()
public void setBinding(ExecBinding binding)
public boolean isUseStderrOnEmptyStdout()
public void setUseStderrOnEmptyStdout(boolean useStderrOnEmptyStdout)
Apache Camel