You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bsurya1989 <bs...@gmail.com> on 2014/05/28 16:48:45 UTC

sftp file exists

Hi,

I am newbie to Apache Camel. I am trying to transfer a file from file(camel
component) to sftp(camel component). But when I transfer a file(AMSTest.txt)
from source (as it polls the source) and transferred to destination(sftp
directory). But when a same file comes in the source for the second time
then it does not transfer the file it.

It transfers if I restart the application server(in my case i am using jetty
server).

my source endpoint is :
file:data/inbox?include=AMS.*.txt&delay=1000&idempotent=true&delete=true

my destination endpoint is :
sftp://test:test@localhost:22/sam/?stepwise=false&fileExist=Move&moveExisting=true

Can anyone give me idea regarding how to accomplish this task?

Thanks in Advance.

Regards,
Surya. 



--
View this message in context: http://camel.465427.n5.nabble.com/sftp-file-exists-tp5751658.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: sftp file exists

Posted by bsurya1989 <bs...@gmail.com>.
Hi Claus,

source
: file:data/inbox?include=AMS.*.txt&delay=1000&idempotent=false&delete=true

destination : sftp://test:test@localhost
:22/sam/?stepwise=false&fileExist=Override&disconnect=true

These endpoints worked fine for me.

The above endpoints does the following :

It polls(for every 1 second) the a folder called 'inbox', which consists of
files starting with 'AMS' pattern. The file is been transfered to sftp
endpoint. If the file already exists at destination then it would replace
the file with latest file coming from source.

Hope this piece of code helps others.

Thanks a lot Claus for your valuable suggestions.

Regards,
Surya.


On Thu, May 29, 2014 at 10:11 AM, Claus Ibsen-2 [via Camel] <
ml-node+s465427n5751691h9@n5.nabble.com> wrote:

> Hi
>
> Sounds like you should use fileExist=Ignore&delete=true
>
>
> On Wed, May 28, 2014 at 7:57 PM, bsurya1989 <[hidden email]
> <http://user/SendEmail.jtp?type=node&node=5751691&i=0>> wrote:
>
> > Thank you.. I am able to transfer the file. Consider a scenario if a
> > file(AMSTest.txt) has to be transferred from  from source(file:
> component)
> > to destination(sftp: component). I am able to transfer it. Now the issue
> > comes when I get another file with the same name AMSTest.txt file in
> source
> > then, it should either override the destination(sftp: component) file
> with
> > the latest one or else it should delete the file from source(file:
> > component), if the file already exists in destination.
> >
> > But I am unable find the correct option supported by sftp: component
> which
> > determines whether the file exists or not in the remote sftp server ?
> >
> > Currently I am using the following endpoint :
> > sftp://test:test@localhost:22/sam/?stepwise=false&fileExist=Override&moveExisting=backup-of-${file:name}
>
> >
> > What kind of option does sftp: component support to find whether file
> exists
> > or not ? And if it exists how can I override the destination file with
> > latest one ?
> >
> > Please provide your suggestion?
> >
> > Thanks In Advance.
> >
> > Thanks and Regards,
> > Surya.
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/sftp-file-exists-tp5751658p5751664.html
>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: [hidden email]
> <http://user/SendEmail.jtp?type=node&node=5751691&i=1>
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/sftp-file-exists-tp5751658p5751691.html
>  To unsubscribe from sftp file exists, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5751658&code=YnN1cnlhMTk4OUBnbWFpbC5jb218NTc1MTY1OHwtOTA5Njk4Mzg4>
> .
> 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>
>




--
View this message in context: http://camel.465427.n5.nabble.com/sftp-file-exists-tp5751658p5751695.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: sftp file exists

Posted by bsurya1989 <bs...@gmail.com>.
Hi Claus,

source :
file:data/inbox?include=AMS.*.txt&delay=1000&idempotent=false&delete=true

destination :
sftp://test:test@localhost:22/sam/?stepwise=false&fileExist=Override&disconnect=true

These endpoints worked fine for me.

The above endpoints does the following : 

It polls(for every 1 second) the a folder called 'inbox', which consists of
files starting with 'AMS' pattern. The file is been transfered to sftp
endpoint. If the file already exists at destination then it would replace
the file with latest file coming from source.

Hope this piece of code helps others.

Thanks a lot Claus for your valuable suggestions.

Regards,
Surya.



--
View this message in context: http://camel.465427.n5.nabble.com/sftp-file-exists-tp5751658p5751694.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: sftp file exists

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

Sounds like you should use fileExist=Ignore&delete=true


On Wed, May 28, 2014 at 7:57 PM, bsurya1989 <bs...@gmail.com> wrote:
> Thank you.. I am able to transfer the file. Consider a scenario if a
> file(AMSTest.txt) has to be transferred from  from source(file: component)
> to destination(sftp: component). I am able to transfer it. Now the issue
> comes when I get another file with the same name AMSTest.txt file in source
> then, it should either override the destination(sftp: component) file with
> the latest one or else it should delete the file from source(file:
> component), if the file already exists in destination.
>
> But I am unable find the correct option supported by sftp: component which
> determines whether the file exists or not in the remote sftp server ?
>
> Currently I am using the following endpoint :
> sftp://test:test@localhost:22/sam/?stepwise=false&fileExist=Override&moveExisting=backup-of-${file:name}
>
> What kind of option does sftp: component support to find whether file exists
> or not ? And if it exists how can I override the destination file with
> latest one ?
>
> Please provide your suggestion?
>
> Thanks In Advance.
>
> Thanks and Regards,
> Surya.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/sftp-file-exists-tp5751658p5751664.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: sftp file exists

Posted by bsurya1989 <bs...@gmail.com>.
Thank you.. I am able to transfer the file. Consider a scenario if a
file(AMSTest.txt) has to be transferred from  from source(file: component)
to destination(sftp: component). I am able to transfer it. Now the issue
comes when I get another file with the same name AMSTest.txt file in source
then, it should either override the destination(sftp: component) file with
the latest one or else it should delete the file from source(file:
component), if the file already exists in destination.

But I am unable find the correct option supported by sftp: component which
determines whether the file exists or not in the remote sftp server ?

Currently I am using the following endpoint :
sftp://test:test@localhost:22/sam/?stepwise=false&fileExist=Override&moveExisting=backup-of-${file:name}

What kind of option does sftp: component support to find whether file exists
or not ? And if it exists how can I override the destination file with
latest one ?

Please provide your suggestion?

Thanks In Advance.

Thanks and Regards,
Surya.



--
View this message in context: http://camel.465427.n5.nabble.com/sftp-file-exists-tp5751658p5751664.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: sftp file exists

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

moveExisting is a pattern, so you should use
moveExisting=backup-of-${file:name} or something like that


On Wed, May 28, 2014 at 4:48 PM, bsurya1989 <bs...@gmail.com> wrote:
> Hi,
>
> I am newbie to Apache Camel. I am trying to transfer a file from file(camel
> component) to sftp(camel component). But when I transfer a file(AMSTest.txt)
> from source (as it polls the source) and transferred to destination(sftp
> directory). But when a same file comes in the source for the second time
> then it does not transfer the file it.
>
> It transfers if I restart the application server(in my case i am using jetty
> server).
>
> my source endpoint is :
> file:data/inbox?include=AMS.*.txt&delay=1000&idempotent=true&delete=true
>
> my destination endpoint is :
> sftp://test:test@localhost:22/sam/?stepwise=false&fileExist=Move&moveExisting=true
>
> Can anyone give me idea regarding how to accomplish this task?
>
> Thanks in Advance.
>
> Regards,
> Surya.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/sftp-file-exists-tp5751658.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/