You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sri <sr...@googlemail.com> on 2010/10/28 14:05:48 UTC

setting headers in destination endpoint for exec

Hello All,

I am using camel-exec for to execute a java command. 

 version I am using are 

Camel 2.5-SNAPSHOT and 
JDK1.6 ver

my requirement is set the parameters in the route from the headers I am
getting from end point.

following is the route i am using .

from("direct:titan")
.to("exec:java?workingDir="+<getFromHeader()>+"&useStderrOnEmptyStdout=true&args=-jar
Titan.jar "+getFromHeader() )
				.process(new Processor() {
				     public void process(Exchange exchange) throws Exception {
				       String processOutput = (String)
exchange.getIn().getBody(String.class);
				       Integer exitCode = (Integer)
exchange.getIn().getHeader(ExecBinding.EXEC_EXIT_VALUE, Integer.class);
				       logger.info(processOutput);
				       logger.info("Exit code: " + exitCode);


I need to pass the highlighted part from the headers.


is there any way that I can send these parameters dynamically I mean
creating the destination end point string dynamically.


thanks in advance for your suggestions.

Regards
Sri





 
-- 
View this message in context: http://camel.465427.n5.nabble.com/setting-headers-in-destination-endpoint-for-exec-tp3240403p3240403.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: setting headers in destination endpoint for exec

Posted by Sri <sr...@googlemail.com>.
I used recipientList pattern and it worked.

Thank you very much.
-- 
View this message in context: http://camel.465427.n5.nabble.com/setting-headers-in-destination-endpoint-for-exec-tp3240403p3240552.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: setting headers in destination endpoint for exec

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Sri,

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

In your case ExecBinding.EXEC_COMMAND_ARGS header which contains a 
List<String> where you can find you workingDir argument.

Regards
JB

On 10/28/2010 02:05 PM, Sri wrote:
>
> Hello All,
>
> I am using camel-exec for to execute a java command.
>
>   version I am using are
>
> Camel 2.5-SNAPSHOT and
> JDK1.6 ver
>
> my requirement is set the parameters in the route from the headers I am
> getting from end point.
>
> following is the route i am using .
>
> from("direct:titan")
> .to("exec:java?workingDir="+<getFromHeader()>+"&useStderrOnEmptyStdout=true&args=-jar
> Titan.jar "+getFromHeader() )
> 				.process(new Processor() {
> 				     public void process(Exchange exchange) throws Exception {
> 				       String processOutput = (String)
> exchange.getIn().getBody(String.class);
> 				       Integer exitCode = (Integer)
> exchange.getIn().getHeader(ExecBinding.EXEC_EXIT_VALUE, Integer.class);
> 				       logger.info(processOutput);
> 				       logger.info("Exit code: " + exitCode);
>
>
> I need to pass the highlighted part from the headers.
>
>
> is there any way that I can send these parameters dynamically I mean
> creating the destination end point string dynamically.
>
>
> thanks in advance for your suggestions.
>
> Regards
> Sri
>
>
>
>
>
>

Re: setting headers in destination endpoint for exec

Posted by Claus Ibsen <cl...@gmail.com>.
Yes look at the EIP patterns such as Recipient List


On Thu, Oct 28, 2010 at 2:05 PM, Sri <sr...@googlemail.com> wrote:
>
> Hello All,
>
> I am using camel-exec for to execute a java command.
>
>  version I am using are
>
> Camel 2.5-SNAPSHOT and
> JDK1.6 ver
>
> my requirement is set the parameters in the route from the headers I am
> getting from end point.
>
> following is the route i am using .
>
> from("direct:titan")
> .to("exec:java?workingDir="+<getFromHeader()>+"&useStderrOnEmptyStdout=true&args=-jar
> Titan.jar "+getFromHeader() )
>                                .process(new Processor() {
>                                     public void process(Exchange exchange) throws Exception {
>                                       String processOutput = (String)
> exchange.getIn().getBody(String.class);
>                                       Integer exitCode = (Integer)
> exchange.getIn().getHeader(ExecBinding.EXEC_EXIT_VALUE, Integer.class);
>                                       logger.info(processOutput);
>                                       logger.info("Exit code: " + exitCode);
>
>
> I need to pass the highlighted part from the headers.
>
>
> is there any way that I can send these parameters dynamically I mean
> creating the destination end point string dynamically.
>
>
> thanks in advance for your suggestions.
>
> Regards
> Sri
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/setting-headers-in-destination-endpoint-for-exec-tp3240403p3240403.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/