You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Olivier Roger <ol...@gmail.com> on 2010/07/13 15:42:55 UTC

[Camel-Exec] Properties and Header values in URI ?

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.

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by Olivier Roger <ol...@gmail.com>.
I just confirm using ExecBinding.EXEC_COMMAND_ARGS does exactly what I
needed.

As explained the parameter value must be a List<String> Java object.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p2636437.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by Olivier Roger <ol...@gmail.com>.
It looks exactly like what I was looking for.

I'll try and get back to you.

Thanks!
-- 
View this message in context: http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p1046797.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by mi...@icw.de.
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 <cl...@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 <ol...@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  

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

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


On Tue, Jul 13, 2010 at 3:42 PM, Olivier Roger <ol...@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

RE: [Camel-Exec] Properties and Header values in URI ?

Posted by nirosha27 <ni...@wipro.com>.

From: nirosha27 [via Camel] [mailto:ml-node+s465427n5745972h29@n5.nabble.com]
Sent: Wednesday, January 15, 2014 10:43 AM
To: Nirosha Chowdari Makkena (WT01 - ENU)
Subject: Re: [Camel-Exec] Properties and Header values in URI ?

Hi Claus,

If I use recipientList it is expecting an Exchange in that ftp location....But my requirement is, once i get the source_directory value, the file which is already present in that ftp location has to be moved to local directory.


           <recipientList>

                 <simple>ftp://username@localhost:21/${in.header.UZVSUBM_SOURCE_DIRECTORY}?password=test</simple>
          </recipientList>

Thanks,
Nirosha
________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p5745972.html
To unsubscribe from [Camel-Exec] Properties and Header values in URI ?, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1046744&code=bmlyb3NoYS5tYWtrZW5hQHdpcHJvLmNvbXwxMDQ2NzQ0fC0xODY3OTkwMTcy>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p5745976.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by nirosha27 <ni...@wipro.com>.
Hi Reji,


<route> 
<from uri="ftp://username@localhost:21/${in.header. 
UZVSUBM_SOURCE_DIRECTORY}?password=test"/> 
<to uri="file:d:/myLocalDirectory"/> 
<route> 

I have already tried this.If I did like this, I am not getting the value of 
${in.header.UZVSUBM_SOURCE_DIRECTORY} in uri....

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p5746016.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by Reji Mathews <co...@gmail.com>.
Hi Nirosha

If you need to move the files from ftp location to the local directory, you
need to configure the ftp component as consumer endpoint.

Something like

<route>
<from uri="ftp://username@localhost:21/${in.header.
UZVSUBM_SOURCE_DIRECTORY}?password=test"/>
<to uri="file:d:/myLocalDirectory"/>
<route>

In your code, you have used it as producer endpoint.


On Wed, Jan 15, 2014 at 10:43 AM, nirosha27 <ni...@wipro.com>wrote:

> Hi Claus,
>
> If I use recipientList it is expecting an Exchange in that ftp
> location....But my requirement is, once i get the source_directory value,
> the file which is already present in that ftp location has to be moved to
> local directory.
>
>
>            <recipientList>
>
>
> <simple>ftp://username@localhost
> :21/${in.header.UZVSUBM_SOURCE_DIRECTORY}?password=test</simple>
>           </recipientList>
>
> Thanks,
> Nirosha
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p5745972.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by nirosha27 <ni...@wipro.com>.
Hi Claus,

If I use recipientList it is expecting an Exchange in that ftp
location....But my requirement is, once i get the source_directory value,
the file which is already present in that ftp location has to be moved to
local directory.


           <recipientList>
 		
                
<simple>ftp://username@localhost:21/${in.header.UZVSUBM_SOURCE_DIRECTORY}?password=test</simple>
          </recipientList>

Thanks,
Nirosha



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p5745972.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this FAQ for "dynamic to"
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

On Tue, Jan 14, 2014 at 2:32 PM, nirosha27 <ni...@wipro.com> wrote:
> Hi,
>
> <bean ref="SqlBean" method="process"/>
>  <setHeader headerName="UZVSUBM_SOURCE_DIRECTORY">
>         <simple>${in.header.UZVSUBM_SOURCE_DIRECTORY}</simple>
> </setHeader>
> <log
> message="ftp://Rajib@localhost:21/${in.header.UZVSUBM_SOURCE_DIRECTORY}?password=test"
> />
>  <to
> uri="ftp://Rajib@localhost:21/${in.header.UZVSUBM_SOURCE_DIRECTORY}?password=test"/>
>
>
>  In the above code, In the log message I was able to get the value of
> Source_Directory value but in ftp uri I was not able to access header
> value....
>
> Please provide the solution...
>
> Thanks
> Nirosha
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p5745942.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: [Camel-Exec] Properties and Header values in URI ?

Posted by nirosha27 <ni...@wipro.com>.
Hi,

<bean ref="SqlBean" method="process"/>
 <setHeader headerName="UZVSUBM_SOURCE_DIRECTORY">
	<simple>${in.header.UZVSUBM_SOURCE_DIRECTORY}</simple>
</setHeader>
<log
message="ftp://Rajib@localhost:21/${in.header.UZVSUBM_SOURCE_DIRECTORY}?password=test"
/>
 <to
uri="ftp://Rajib@localhost:21/${in.header.UZVSUBM_SOURCE_DIRECTORY}?password=test"/>


 In the above code, In the log message I was able to get the value of
Source_Directory value but in ftp uri I was not able to access header
value....

Please provide the solution...

Thanks
Nirosha		



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Exec-Properties-and-Header-values-in-URI-tp1046744p5745942.html
Sent from the Camel - Users mailing list archive at Nabble.com.