You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gustavo Franke <fr...@gmail.com> on 2010/10/18 23:56:11 UTC

issue moving files to ftp

Here's what I have in my RouteBuilder

public void configure() {
        String localWorkFolder = "/tmp/camel";
        from("ftp://gustavo@localhost:21/Test?password=gustavo&move=.processed").to("file://"
+ localWorkFolder);
        from("file://" + localWorkFolder + "?noop=true").beanRef("parser",
"convert");
        from("file:///tmp/camelout").to("ftp://gustavo
@localhost:21/Test/out?password=gustavo&fileName=${file:onlyname}");
    }

I'm not sure if I am missing some thing but on the java app side the files
are generated properly, those files should be copied to the ftp.
But for some reason, on the ftp side the files are generated but its content
is missing or corrupt, and I'm completely clueless regarding to this.

If I don't explicit the &fileName=${file:onlyname} I get this error "Error
writing file [Test/out/C:\tmp\camel\myFile.txt]" being Test/out the remote
folder and C:\tmp\camel\myFile.txt path of the file. That's the reason why I
added the &fileName=${file:onlyname} but I don't know why the content is
missing.

Any help would be great.
Thanks,
Gustavo

Re: issue moving files to ftp

Posted by Gustavo Franke <fr...@gmail.com>.
Yes I did, this line calls the logic that does that  from("file://" +
localWorkFolder + "?noop=true").beanRef("parser","convert"); and I can
see in /tmp/camelout those files proper generated. I've started this
thread because of the only goofy thing here is when moving to the FTP.

Plus I've found that if I manually create the file and then run the
app, it works fine... is there a way to ensure that the file is
created before copying to the ftp or like?

I'm using windows and filezilla server right now, but this process
will run in a Unix-like environment.

On 10/18/10, Willem Jiang <wi...@gmail.com> wrote:
> Did you wrote the file into /tmp/camelout ?
> I didn't find any route which will put the files into /tmp/camelout
> directory.
>
> On 10/19/10 5:56 AM, Gustavo Franke wrote:
>> Here's what I have in my RouteBuilder
>>
>> public void configure() {
>>          String localWorkFolder = "/tmp/camel";
>>
>> from("ftp://gustavo@localhost:21/Test?password=gustavo&move=.processed").to("file://"
>> + localWorkFolder);
>>          from("file://" + localWorkFolder +
>> "?noop=true").beanRef("parser",
>> "convert");
>>          from("file:///tmp/camelout").to("ftp://gustavo
>> @localhost:21/Test/out?password=gustavo&fileName=${file:onlyname}");
>>      }
>>
>> I'm not sure if I am missing some thing but on the java app side the files
>> are generated properly, those files should be copied to the ftp.
>> But for some reason, on the ftp side the files are generated but its
>> content
>> is missing or corrupt, and I'm completely clueless regarding to this.
>>
>> If I don't explicit the&fileName=${file:onlyname} I get this error "Error
>> writing file [Test/out/C:\tmp\camel\myFile.txt]" being Test/out the remote
>> folder and C:\tmp\camel\myFile.txt path of the file. That's the reason why
>> I
>> added the&fileName=${file:onlyname} but I don't know why the content is
>> missing.
>>
>> Any help would be great.
>> Thanks,
>> Gustavo
>>
>
>
> --
> Willem
> ----------------------------------
> Open Source Integration: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>           http://jnn.javaeye.com (Chinese)
> Twitter: http://twitter.com/willemjiang
>

Re: issue moving files to ftp

Posted by Willem Jiang <wi...@gmail.com>.
Did you wrote the file into /tmp/camelout ?
I didn't find any route which will put the files into /tmp/camelout 
directory.

On 10/19/10 5:56 AM, Gustavo Franke wrote:
> Here's what I have in my RouteBuilder
>
> public void configure() {
>          String localWorkFolder = "/tmp/camel";
>          from("ftp://gustavo@localhost:21/Test?password=gustavo&move=.processed").to("file://"
> + localWorkFolder);
>          from("file://" + localWorkFolder + "?noop=true").beanRef("parser",
> "convert");
>          from("file:///tmp/camelout").to("ftp://gustavo
> @localhost:21/Test/out?password=gustavo&fileName=${file:onlyname}");
>      }
>
> I'm not sure if I am missing some thing but on the java app side the files
> are generated properly, those files should be copied to the ftp.
> But for some reason, on the ftp side the files are generated but its content
> is missing or corrupt, and I'm completely clueless regarding to this.
>
> If I don't explicit the&fileName=${file:onlyname} I get this error "Error
> writing file [Test/out/C:\tmp\camel\myFile.txt]" being Test/out the remote
> folder and C:\tmp\camel\myFile.txt path of the file. That's the reason why I
> added the&fileName=${file:onlyname} but I don't know why the content is
> missing.
>
> Any help would be great.
> Thanks,
> Gustavo
>


-- 
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang

Re: issue moving files to ftp

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Oct 20, 2010 at 11:21 PM, Gustavo Franke
<fr...@gmail.com> wrote:
> Based on your suggestion I've wrote this
>
>        from(FTPS_ENDPOINT
> +"?password=gustavo&move=processed?localWorkDirectory="+ localWorkFolder)
>            .beanRef("parser", "convert")
>            .to(FTPS_ENDPOINT
> +"/out?password=gustavo&fileName=${file:onlyname}")
>            ;
> but for some reason the localWorkDirectory doesn't seems to be working (I
> don't see the files copied in there).
> and I'm getting a FileNotFoundException (in the FTP side) and the file is
> there.
> Do I need more detailed info besides http://camel.apache.org/ftp2 ?
>

At first just try to get the file downloaded.
Then later add that 2nd step to upload the file again.

And where do you get that exception?

> Thanks,
> Gustavo.
>
> On Tue, Oct 19, 2010 at 8:23 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> The FTP component supports a local work folder directly.
>>
>> See the localWorkDirectory option
>> http://camel.apache.org/ftp2
>>
>> Then you can do
>>
>> from(ftp:xxx?localWorkDirectory=/somepath").beanRef("parser",
>> "convert").xxx?
>>
>>
>> On Mon, Oct 18, 2010 at 11:56 PM, Gustavo Franke
>> <fr...@gmail.com> wrote:
>> > Here's what I have in my RouteBuilder
>> >
>> > public void configure() {
>> >        String localWorkFolder = "/tmp/camel";
>> >        from("ftp://gustavo
>> @localhost:21/Test?password=gustavo&move=.processed").to("file://"
>> > + localWorkFolder);
>> >        from("file://" + localWorkFolder + "?noop=true").beanRef("parser",
>> > "convert");
>> >        from("file:///tmp/camelout").to("ftp://gustavo
>> > @localhost:21/Test/out?password=gustavo&fileName=${file:onlyname}");
>> >    }
>> >
>> > I'm not sure if I am missing some thing but on the java app side the
>> files
>> > are generated properly, those files should be copied to the ftp.
>> > But for some reason, on the ftp side the files are generated but its
>> content
>> > is missing or corrupt, and I'm completely clueless regarding to this.
>> >
>> > If I don't explicit the &fileName=${file:onlyname} I get this error
>> "Error
>> > writing file [Test/out/C:\tmp\camel\myFile.txt]" being Test/out the
>> remote
>> > folder and C:\tmp\camel\myFile.txt path of the file. That's the reason
>> why I
>> > added the &fileName=${file:onlyname} but I don't know why the content is
>> > missing.
>> >
>> > Any help would be great.
>> > Thanks,
>> > Gustavo
>> >
>>
>>
>>
>> --
>> 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
>>
>



-- 
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: issue moving files to ftp

Posted by Gustavo Franke <fr...@gmail.com>.
Based on your suggestion I've wrote this

        from(FTPS_ENDPOINT
+"?password=gustavo&move=processed?localWorkDirectory="+ localWorkFolder)
            .beanRef("parser", "convert")
            .to(FTPS_ENDPOINT
+"/out?password=gustavo&fileName=${file:onlyname}")
            ;
but for some reason the localWorkDirectory doesn't seems to be working (I
don't see the files copied in there).
and I'm getting a FileNotFoundException (in the FTP side) and the file is
there.
Do I need more detailed info besides http://camel.apache.org/ftp2 ?

Thanks,
Gustavo.

On Tue, Oct 19, 2010 at 8:23 AM, Claus Ibsen <cl...@gmail.com> wrote:

> The FTP component supports a local work folder directly.
>
> See the localWorkDirectory option
> http://camel.apache.org/ftp2
>
> Then you can do
>
> from(ftp:xxx?localWorkDirectory=/somepath").beanRef("parser",
> "convert").xxx?
>
>
> On Mon, Oct 18, 2010 at 11:56 PM, Gustavo Franke
> <fr...@gmail.com> wrote:
> > Here's what I have in my RouteBuilder
> >
> > public void configure() {
> >        String localWorkFolder = "/tmp/camel";
> >        from("ftp://gustavo
> @localhost:21/Test?password=gustavo&move=.processed").to("file://"
> > + localWorkFolder);
> >        from("file://" + localWorkFolder + "?noop=true").beanRef("parser",
> > "convert");
> >        from("file:///tmp/camelout").to("ftp://gustavo
> > @localhost:21/Test/out?password=gustavo&fileName=${file:onlyname}");
> >    }
> >
> > I'm not sure if I am missing some thing but on the java app side the
> files
> > are generated properly, those files should be copied to the ftp.
> > But for some reason, on the ftp side the files are generated but its
> content
> > is missing or corrupt, and I'm completely clueless regarding to this.
> >
> > If I don't explicit the &fileName=${file:onlyname} I get this error
> "Error
> > writing file [Test/out/C:\tmp\camel\myFile.txt]" being Test/out the
> remote
> > folder and C:\tmp\camel\myFile.txt path of the file. That's the reason
> why I
> > added the &fileName=${file:onlyname} but I don't know why the content is
> > missing.
> >
> > Any help would be great.
> > Thanks,
> > Gustavo
> >
>
>
>
> --
> 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: issue moving files to ftp

Posted by Claus Ibsen <cl...@gmail.com>.
The FTP component supports a local work folder directly.

See the localWorkDirectory option
http://camel.apache.org/ftp2

Then you can do

from(ftp:xxx?localWorkDirectory=/somepath").beanRef("parser", "convert").xxx?


On Mon, Oct 18, 2010 at 11:56 PM, Gustavo Franke
<fr...@gmail.com> wrote:
> Here's what I have in my RouteBuilder
>
> public void configure() {
>        String localWorkFolder = "/tmp/camel";
>        from("ftp://gustavo@localhost:21/Test?password=gustavo&move=.processed").to("file://"
> + localWorkFolder);
>        from("file://" + localWorkFolder + "?noop=true").beanRef("parser",
> "convert");
>        from("file:///tmp/camelout").to("ftp://gustavo
> @localhost:21/Test/out?password=gustavo&fileName=${file:onlyname}");
>    }
>
> I'm not sure if I am missing some thing but on the java app side the files
> are generated properly, those files should be copied to the ftp.
> But for some reason, on the ftp side the files are generated but its content
> is missing or corrupt, and I'm completely clueless regarding to this.
>
> If I don't explicit the &fileName=${file:onlyname} I get this error "Error
> writing file [Test/out/C:\tmp\camel\myFile.txt]" being Test/out the remote
> folder and C:\tmp\camel\myFile.txt path of the file. That's the reason why I
> added the &fileName=${file:onlyname} but I don't know why the content is
> missing.
>
> Any help would be great.
> Thanks,
> Gustavo
>



-- 
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