Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

where executable is the name, or file path, of the system command that will be executed. If executable name is used (e.g. exec:java), the executable must in the system path.

URI options

Div
classconfluenceTableSmall
Wiki Markup
{div:class=confluenceTableSmall} || Name || Default value || Description || | {{args}} | {{null}} | The arguments of the executable. The arguments may be one or many whitespace-separated tokens, that can be quoted with {{"}} - e.g. {{args="arg 1" arg2}} will use two arguments {{arg 1}} and {{arg2}}. To include the quotes use {{""}} - e.g. {{args=""arg 1"" arg2}} will use the arguments {{"arg 1"}} and {{arg2}}.| | {{workingDir}} | {{null}} |The directory in which the command should be executed. If {{null}}, the working directory of the current process will be used.| | {{timeout}} | {{Long.MAX_VALUE}}|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.| | {{outFile}} | {{null}} |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. | | {{binding}} | a {{DefaultExecBinding}} instance | A reference to a {{

Name

Default value

Description

args

null

The arguments of the executable. The arguments may be one or many
whitespace-separated tokens, that can be quoted with " - e.g. args="arg 1" arg2 will use two arguments arg 1 and arg2. To include the quotes use "" - e.g. args=""arg 1"" arg2 will use the arguments "arg 1" and arg2.

workingDir

null

The directory in which the command should be executed. If null, the working directory of the current process will be used.

timeout

Long.MAX_VALUE

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.

outFile

null

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.

binding

a DefaultExecBinding instance

A reference to a

org.apache.commons.exec.ExecBinding

}}

in

the

[|http://camel.apache.org/registry.html].| | {{commandExecutor}} |a {{DefaultCommandExecutor}} instance | A reference to a {{

.

commandExecutor

a DefaultCommandExecutor instance

A reference to a org.apache.commons.exec.ExecCommandExecutor

}}

in

the

[|http://camel.apache.org/registry.html]

that

customizes

the

command

execution.

The

default

command

executor

utilizes

the

[ |http://commons.apache.org/exec/]

,

which

adds

a

shutdown

hook

for

every

executed

command.

| | {{useStderrOnEmptyStdout}} | {{false}} | 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. | {div}

useStderrOnEmptyStdout

false

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.

Message headers

The supported headers are defined in org.apache.camel.component.exec.ExecBinding.

Div
classconfluenceTableSmall
Wiki Markup
{div:class=confluenceTableSmall} ||Name||Type||Message ||Description|| |{{

Name

Type

Message

Description

ExecBinding.EXEC_COMMAND_EXECUTABLE

}}|{{String}}|{{in}}| The name of the system command that will be executed. Overrides {{executable}} in the URI.| |{{

String

in

The name of the system command that will be executed. Overrides executable in the URI.

ExecBinding.EXEC_COMMAND_ARGS

}}|{{

java.util.List<String>

}}|{{in}}|

in

Command-line

arguments

to

pass

to

the

executed

process.

The

arguments

are

used

literally

-

no

quoting

is

applied.

Overrides

any

existing

{{

args

}}

in

the

URI.

| |{{

ExecBinding.EXEC_COMMAND_ARGS

}}|{{String}}|{{in}}| *Camel

String

in

Camel 2.5:

*

The

arguments

of

the

executable

as

a

Single

string

where

each

argument

is

whitespace

separated

(see

{{

args

}}

in

URI

option).

The

arguments

are

used

literally,

no

quoting

is

applied.

Overrides

any

existing

{{

args

}}

in

the

URI.

| |{{

ExecBinding.EXEC_COMMAND_OUT_FILE

}}|{{String}}|{{in}}|The name of a file, created by the executable, that should be considered as its output. Overrides any existing {{outFile}} in the URI.| |{{

String

in

The name of a file, created by the executable, that should be considered as its output. Overrides any existing outFile in the URI.

ExecBinding.EXEC_COMMAND_TIMEOUT

}}|{{long}}|{{in}}|The timeout, in milliseconds, after which the executable should be terminated. Overrides any existing {{timeout}} in the URI.| |{{

long

in

The timeout, in milliseconds, after which the executable should be terminated. Overrides any existing timeout in the URI.

ExecBinding.EXEC_COMMAND_WORKING_DIR

}}|{{String}}|{{in}}|The directory in which the command should be executed. Overrides any existing {{workingDir}} in the URI.| |{{

String

in

The directory in which the command should be executed. Overrides any existing workingDir in the URI.

ExecBinding.EXEC_EXIT_VALUE

}}|{{int}}|{{out}}|The value of this header is the _exit value_ of the executable. Non-zero exit values typically indicate abnormal termination. Note that the exit value is OS-dependent.| |{{ExecBinding.EXEC_STDERR}}|{{java.io.InputStream}}|{{out}}|The value of this header points to the standard error stream (stderr) of the executable. If no stderr is written, the value is {{null}}.| |{{

int

out

The value of this header is the exit value of the executable. Non-zero exit values typically indicate abnormal termination. Note that the exit value is OS-dependent.

ExecBinding.EXEC_STDERR

java.io.InputStream

out

The value of this header points to the standard error stream (stderr) of the executable. If no stderr is written, the value is null.

ExecBinding.EXEC_USE_STDERR_ON_EMPTY_STDOUT

}}|{{boolean}}|{{in}}| Indicates that when {{stdout}} is empty, this component will populate the Camel Message Body with {{stderr}}. This behavior is disabled ({{false}}) by default. | {div}

boolean

in

Indicates that when stdout is empty, this component will populate the Camel Message Body with stderr. This behavior is disabled (false) by default.

Message body

If the Exec component receives an in message body that is convertible to java.io.InputStream, it is used to feed input to the executable via its stdin. After execution, the message body is the result of the execution,- that is, an org.apache.camel.components.exec.ExecResult instance containing the stdout, stderr, exit value, and out file. This component supports the following ExecResult type converters for convenience:

Div
classconfluenceTableSmall
Wiki Markup
{div:class=confluenceTableSmall} ||From||To|| |{{ExecResult}} | {{

From

To

ExecResult

java.io.InputStream

}}| |{{ExecResult}} | {{String}}| |{{ExecResult}} | {{byte \[\]}}| |{{ExecResult}} | {{

ExecResult

String

ExecResult

byte []

ExecResult

org.w3c.dom.Document

}}|

If

an

out

file

is

specified

(in

the

endpoint

via

{{

outFile

}}

or

the

message

headers

via

{{

ExecBinding.EXEC_COMMAND_OUT_FILE

}}

),

converters

will

return

the

content

of

the

out

file.

If

no

out

file

is

used,

then

this

component

will

convert

the

stdout

of

the

process

to

the

target

type.

For

more

details,

please

refer

to

the

[

usage

examples

|#usage]

below.

{div}

Anchor
usage
usage

Usage examples

...