Hi Oliver,

 you can also use the ExecBinding.EXEC_COMMAND_ARGS header to set the 
command args dynamically.  The header value must be a List<String> with 
the args. 

You may even implement your own org.apache.camle.Expression that returns 
the list based on the Camel exhcange (e.g. based on Exchange.FILE_NAME).

Such Java DSL would look like:

...
.setHeader(ExecBinding.EXEC_COMMAND_ARGS , new YourArgsProviderExpression(
))

....
class YourArgsProviderExpression imlements org.apache.camle.Expression{
 ...
}


Hope this helps.

Regards, 
Mitko






From:
Claus Ibsen <claus.ib...@gmail.com>
To:
users@camel.apache.org
Date:
13.07.2010 15:50
Subject:
Re: [Camel-Exec] Properties and Header values in URI ?



Hi

You can use the recipient list pattern for such dynamic endpoints.


On Tue, Jul 13, 2010 at 3:42 PM, Olivier Roger <olivier.ro...@gmail.com> 
wrote:
>
> Hello,
>
> Is it possible to use values that have been set in the header 
(setHeader) or
> in a property (setProperty) to changes the arguments given to the 
Camel-exec
> component ?
> Here under is an example of what I have in mind:
>
>        <from uri="direct:test" />
>
>        <setProperty
> propertyName="InputFile"><constant>test.csv</constant></setProperty>
>        <setHeader headerName="Arguments"><constant>ok 
123</constant></setHeader>
>
>        <to uri="exec:perl?args=perl.pl ${property.InputFile}
> ${in.headers.Arguments}$&amp;workingDir=target\classes" />
>        <log message="Executing Perl perl.pl" loggingLevel="INFO" 
logName="myLog"/>
>
>        <to ref="out" />
>
> Thank in advance,
>
> Olivier
> --
> View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p1046744.html

> Sent from the Camel - Users (activemq) mailing list archive at 
Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus




InterComponentWare AG:  
Vorstand: Peter Kirschbauer (Vors.), Jörg Stadler / Aufsichtsratsvors.: Prof. 
Dr. Christof Hettich  
Firmensitz: 69190 Walldorf, Altrottstraße 31 / AG Mannheim HRB 351761 / 
USt.-IdNr.: DE 198388516  

Reply via email to