Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The exec component can be used to execute a system command.

Dependencies

Maven users need to add the following dependency to their pom.xml

Code Block
xml:titlepom.xml

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-exec</artifactId>
<version>${camel-version}</version>
</dependency>

where ${camel-version} must be replaced by the actual version of Camel (2.3.0 or higher).

URI format

Code Block
xml
xml
exec://executable[?options]

...

Code Block
java
java
from("direct:exec")
.to("exec:ant.bat?args=-f CamelExecBuildFile.xml -l CamelExecOutFile.txt&outFile=CamelExecOutFile.txt")
.process(new Processor() {
     public void process(Exchange exchange) throws Exception {
        InputStream outFile = exchange.getIn().getBody(InputStream.class);
        assertIsInstanceOf(InputStream.class, outFile);
        // do something with the out file here
     }
  });

Dependencies

Maven users need to add the following dependency to their pom.xml

Code Block
xml:titlepom.xml

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-exec</artifactId>
<version>${camel-version}</version>
</dependency>

...

Include Page
CAMEL:Endpoint See Also
CAMEL:Endpoint See Also