Exec
Execute commands on the underlying operating system.
What’s inside
-
Exec component, URI syntax:
exec:executable
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-exec-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 8 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.exec.allow-control-headers | Whether the CamelExecCommandExecutable, CamelExecCommandArgs, CamelExecCommandOutFile, CamelExecCommandWorkingDir, CamelExecCommandTimeout, CamelExecExitValues, CamelExecUseStderrOnEmptyStdout and CamelExecCommandLogLevel headers override the matching endpoint options. When false (the default since Camel 4.20), these headers are ignored and left on the message, and a WARN is logged once per endpoint. When true, these headers are used and removed from the message. Enable only when the route sets these headers itself, not when they can come from an untrusted sender. | false | Boolean |
camel.component.exec.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.exec.binding | A custom org.apache.camel.component.exec.ExecBinding that creates the command from the message and the endpoint options, and writes the ExecResult to the message. The default is DefaultExecBinding. The option is a org.apache.camel.component.exec.ExecBinding type. | ExecBinding | |
camel.component.exec.command-executor | A custom org.apache.camel.component.exec.ExecCommandExecutor that runs the command. When not set, a new default executor is created for each message: it runs the command with the Apache Commons Exec DefaultExecutor, reads the standard output and the standard error into memory, and registers a JVM shutdown hook while the command runs, so that the process is destroyed when the JVM exits. The option is a org.apache.camel.component.exec.ExecCommandExecutor type. | ExecCommandExecutor | |
camel.component.exec.enabled | Whether to enable auto configuration of the exec component. This is enabled by default. | Boolean | |
camel.component.exec.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.exec.timeout | The timeout, in milliseconds, for the command to finish. When the timeout is reached, the process is destroyed (Process.destroy()) and the message continues with the exit value of the destroyed process: no exception is raised unless exitValues is set and does not contain that value. The value must be positive. When not set, there is no timeout. | Long | |
camel.component.exec.working-dir | The working directory of the command. A relative path is resolved against the working directory of the JVM. When not set, the command runs in the working directory of the JVM. The execution fails with an ExecException when the directory does not exist. | String |