You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by havoc <ra...@gmail.com> on 2014/11/21 15:17:32 UTC
Camel FTP, sending a single file, the simplest way, for a noob
Hello,
I am unfortunately a camel noob and need to implement a quick fix.
I have a route which has.
.process(new Processor() {
@Override
public void process(Exchange exchng) throws Exception {
String fullPathOfFileToSendViaFtp = getSomeInfoFromHeaders();
//What do I need to enter to the camel body and headers for Camel FTP to
Read this file, and only this //file and send it via ftp ??
String ftpUri = getFtpUri();
exchng.getIn().setHeader("my.ftp.uri",ftpUri);
}
}
).to().recipientlist(header("my.ftp.uri"));
Is this the right approach at all ? Do I need a FileReader in the middle ?
How do I do that ?
Nowhere did I find sufficient documentation for that....
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-FTP-sending-a-single-file-the-simplest-way-for-a-noob-tp5759452.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel FTP, sending a single file, the simplest way, for a noob
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Use the CamelFileName (Exchange.FILE_NAME) header to set the name of
the file you want to upload the file as on the FTP server. See more
details at
http://camel.apache.org/file2
http://camel.apache.org/file-language.html
Use the dynamic to pattern if you need to send to different FTP servers
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html
On Fri, Nov 21, 2014 at 3:59 PM, havoc <ra...@gmail.com> wrote:
> Hello,
>
> Yes, sorry my original post was not clear
>
> 1. I have a file that the previous route processor has written to the disk
> 2. The file name is different every time
> 3. Inside the process() method in the code above, I get the file name and
> path on the local disk from the header information
> 4. The ftp uri (the address where I want to send the file), also changes
> depending on the file, so I also get it from the header, set by the previous
> processor
> 5. Now, I need to tell camel ftp to send this file to the given ftp uri, but
> I am not sure how to set this file in the header / body for ftp to read it
>
> Also, using .recipientList(header("camel.trade.ftpuri")); was the only way I
> found that I could give a dynamic uri to ftp...
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-FTP-sending-a-single-file-the-simplest-way-for-a-noob-tp5759452p5759462.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
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Re: Camel FTP, sending a single file, the simplest way, for a noob
Posted by havoc <ra...@gmail.com>.
Hello,
Yes, sorry my original post was not clear
1. I have a file that the previous route processor has written to the disk
2. The file name is different every time
3. Inside the process() method in the code above, I get the file name and
path on the local disk from the header information
4. The ftp uri (the address where I want to send the file), also changes
depending on the file, so I also get it from the header, set by the previous
processor
5. Now, I need to tell camel ftp to send this file to the given ftp uri, but
I am not sure how to set this file in the header / body for ftp to read it
Also, using .recipientList(header("camel.trade.ftpuri")); was the only way I
found that I could give a dynamic uri to ftp...
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-FTP-sending-a-single-file-the-simplest-way-for-a-noob-tp5759452p5759462.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel FTP, sending a single file, the simplest way, for a noob
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Do you mind explain again what you want to do, its not so clear.
On Fri, Nov 21, 2014 at 3:17 PM, havoc <ra...@gmail.com> wrote:
> Hello,
>
> I am unfortunately a camel noob and need to implement a quick fix.
>
> I have a route which has.
> .process(new Processor() {
>
> @Override
> public void process(Exchange exchng) throws Exception {
>
> String fullPathOfFileToSendViaFtp = getSomeInfoFromHeaders();
>
> //What do I need to enter to the camel body and headers for Camel FTP to
> Read this file, and only this //file and send it via ftp ??
>
> String ftpUri = getFtpUri();
> exchng.getIn().setHeader("my.ftp.uri",ftpUri);
>
> }
> }
> ).to().recipientlist(header("my.ftp.uri"));
>
> Is this the right approach at all ? Do I need a FileReader in the middle ?
> How do I do that ?
> Nowhere did I find sufficient documentation for that....
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-FTP-sending-a-single-file-the-simplest-way-for-a-noob-tp5759452.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
hawtio: http://hawt.io/
fabric8: http://fabric8.io/