You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by qwerty5000 <yu...@barclays.com> on 2012/05/09 14:18:33 UTC
how to specify remote file name when using FTP endpoint
I'm trying to ftp a file to a remote ftp server but I can't figure out how to
specify the remote file name without changing the local file name.
e.g. I have a file called a.txt. I would like to ftp it to a remote host
with a file name b.txt. When the ftp completes, I still want to be able to
refer to the file as a.txt on the local system.
Is there a way to do this?
Cheers.
--
View this message in context: http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: how to specify remote file name when using FTP endpoint
Posted by qwerty5000 <yu...@barclays.com>.
I can now get it to work using the re-renaming approach.
Thanks all.
--
View this message in context: http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5699753.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: how to specify remote file name when using FTP endpoint
Posted by Bengt Rodehav <be...@rodehav.com>.
JIRA created:
https://issues.apache.org/jira/browse/CAMEL-5269
/Bengt
2012/5/10 Claus Ibsen <cl...@gmail.com>
> On Thu, May 10, 2012 at 12:59 PM, Bengt Rodehav <be...@rodehav.com> wrote:
> > I think it would be a good feature to have. Our integration counterparts
> > often require that the name of the file we send to them is hardcoded (i e
> > it should always be the same name) or conform to a naming standard
> defined
> > by the receiver. But internally, on the sending side, the original file
> is
> > often named completely differently. We then put files that we have
> > correctly handled in an archive directory and the ones we could not
> handle
> > in a failed directory. In those cases it is important that we locally
> > archive with the original file name to have full traceability.
> >
> > In short, yes support for this would be useful.
> >
>
> Fell free to create a JIRA ticket.
>
> > /Bengt
> >
> > 2012/5/10 Claus Ibsen <cl...@gmail.com>
> >
> >> On Thu, May 10, 2012 at 11:23 AM, Bengt Rodehav <be...@rodehav.com>
> wrote:
> >> > I do this in Camel 2.7.1 and it definitely changes the name of the
> file
> >> > before ftp:ing:
> >> >
> >> > *theExchange.getIn().setHeader(Exchange.FILE_NAME, "newfilename");*
> >> >
> >>
> >> Yeah you need to store the original file in another header before hand,
> >> and then restore it back again afterwards.
> >>
> >> We may wonder some way of making this easier if this is more commonly
> >> used use-case.
> >> Anyone else picking up files, and storing them using a different file
> >> name, and then have to preserve
> >> the original file name afterwards ?
> >>
> >> > Hope that helps,
> >> >
> >> > /Bengt
> >> >
> >> > 2012/5/10 qwerty5000 <yu...@barclays.com>
> >> >
> >> >> Thanks guys, but the solution you suggested would rename the files
> after
> >> >> the
> >> >> ftp step so doesn't work.
> >> >>
> >> >> Anyway to retain the original file name? This is necessary as I need
> to
> >> >> perform some local processing after the file has been ftpd, and I
> need
> >> to
> >> >> use the file name as some sort of an uid.
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5699472.html
> >> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >>
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> Twitter: davsclaus, fusenews
> >> Blog: http://davsclaus.blogspot.com/
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
Re: how to specify remote file name when using FTP endpoint
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, May 10, 2012 at 12:59 PM, Bengt Rodehav <be...@rodehav.com> wrote:
> I think it would be a good feature to have. Our integration counterparts
> often require that the name of the file we send to them is hardcoded (i e
> it should always be the same name) or conform to a naming standard defined
> by the receiver. But internally, on the sending side, the original file is
> often named completely differently. We then put files that we have
> correctly handled in an archive directory and the ones we could not handle
> in a failed directory. In those cases it is important that we locally
> archive with the original file name to have full traceability.
>
> In short, yes support for this would be useful.
>
Fell free to create a JIRA ticket.
> /Bengt
>
> 2012/5/10 Claus Ibsen <cl...@gmail.com>
>
>> On Thu, May 10, 2012 at 11:23 AM, Bengt Rodehav <be...@rodehav.com> wrote:
>> > I do this in Camel 2.7.1 and it definitely changes the name of the file
>> > before ftp:ing:
>> >
>> > *theExchange.getIn().setHeader(Exchange.FILE_NAME, "newfilename");*
>> >
>>
>> Yeah you need to store the original file in another header before hand,
>> and then restore it back again afterwards.
>>
>> We may wonder some way of making this easier if this is more commonly
>> used use-case.
>> Anyone else picking up files, and storing them using a different file
>> name, and then have to preserve
>> the original file name afterwards ?
>>
>> > Hope that helps,
>> >
>> > /Bengt
>> >
>> > 2012/5/10 qwerty5000 <yu...@barclays.com>
>> >
>> >> Thanks guys, but the solution you suggested would rename the files after
>> >> the
>> >> ftp step so doesn't work.
>> >>
>> >> Anyway to retain the original file name? This is necessary as I need to
>> >> perform some local processing after the file has been ftpd, and I need
>> to
>> >> use the file name as some sort of an uid.
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5699472.html
>> >> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: how to specify remote file name when using FTP endpoint
Posted by Bengt Rodehav <be...@rodehav.com>.
I think it would be a good feature to have. Our integration counterparts
often require that the name of the file we send to them is hardcoded (i e
it should always be the same name) or conform to a naming standard defined
by the receiver. But internally, on the sending side, the original file is
often named completely differently. We then put files that we have
correctly handled in an archive directory and the ones we could not handle
in a failed directory. In those cases it is important that we locally
archive with the original file name to have full traceability.
In short, yes support for this would be useful.
/Bengt
2012/5/10 Claus Ibsen <cl...@gmail.com>
> On Thu, May 10, 2012 at 11:23 AM, Bengt Rodehav <be...@rodehav.com> wrote:
> > I do this in Camel 2.7.1 and it definitely changes the name of the file
> > before ftp:ing:
> >
> > *theExchange.getIn().setHeader(Exchange.FILE_NAME, "newfilename");*
> >
>
> Yeah you need to store the original file in another header before hand,
> and then restore it back again afterwards.
>
> We may wonder some way of making this easier if this is more commonly
> used use-case.
> Anyone else picking up files, and storing them using a different file
> name, and then have to preserve
> the original file name afterwards ?
>
> > Hope that helps,
> >
> > /Bengt
> >
> > 2012/5/10 qwerty5000 <yu...@barclays.com>
> >
> >> Thanks guys, but the solution you suggested would rename the files after
> >> the
> >> ftp step so doesn't work.
> >>
> >> Anyway to retain the original file name? This is necessary as I need to
> >> perform some local processing after the file has been ftpd, and I need
> to
> >> use the file name as some sort of an uid.
> >>
> >> --
> >> View this message in context:
> >>
> http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5699472.html
> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
Re: how to specify remote file name when using FTP endpoint
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, May 10, 2012 at 11:23 AM, Bengt Rodehav <be...@rodehav.com> wrote:
> I do this in Camel 2.7.1 and it definitely changes the name of the file
> before ftp:ing:
>
> *theExchange.getIn().setHeader(Exchange.FILE_NAME, "newfilename");*
>
Yeah you need to store the original file in another header before hand,
and then restore it back again afterwards.
We may wonder some way of making this easier if this is more commonly
used use-case.
Anyone else picking up files, and storing them using a different file
name, and then have to preserve
the original file name afterwards ?
> Hope that helps,
>
> /Bengt
>
> 2012/5/10 qwerty5000 <yu...@barclays.com>
>
>> Thanks guys, but the solution you suggested would rename the files after
>> the
>> ftp step so doesn't work.
>>
>> Anyway to retain the original file name? This is necessary as I need to
>> perform some local processing after the file has been ftpd, and I need to
>> use the file name as some sort of an uid.
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5699472.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: how to specify remote file name when using FTP endpoint
Posted by Bengt Rodehav <be...@rodehav.com>.
I do this in Camel 2.7.1 and it definitely changes the name of the file
before ftp:ing:
*theExchange.getIn().setHeader(Exchange.FILE_NAME, "newfilename");*
Hope that helps,
/Bengt
2012/5/10 qwerty5000 <yu...@barclays.com>
> Thanks guys, but the solution you suggested would rename the files after
> the
> ftp step so doesn't work.
>
> Anyway to retain the original file name? This is necessary as I need to
> perform some local processing after the file has been ftpd, and I need to
> use the file name as some sort of an uid.
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5699472.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: how to specify remote file name when using FTP endpoint
Posted by qwerty5000 <yu...@barclays.com>.
Thanks guys, but the solution you suggested would rename the files after the
ftp step so doesn't work.
Anyway to retain the original file name? This is necessary as I need to
perform some local processing after the file has been ftpd, and I need to
use the file name as some sort of an uid.
--
View this message in context: http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5699472.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: how to specify remote file name when using FTP endpoint
Posted by Christian Müller <ch...@gmail.com>.
Or in Java DSL:
setHeader("CamelFileName", "someNewFileName.txt");
Best,
Christian
On Wed, May 9, 2012 at 11:53 PM, ychawla <pr...@yahoo.com>wrote:
> Hi,
> Did you try setting the camel file name header:
>
>
> <camel:setHeader headerName="CamelFileName">
> <camel:simple>someNewFileName.txt</camel:simple>
> </camel:setHeader>
>
> Thanks,
> Yogesh
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5698676.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: how to specify remote file name when using FTP endpoint
Posted by ychawla <pr...@yahoo.com>.
Hi,
Did you try setting the camel file name header:
<camel:setHeader headerName="CamelFileName">
<camel:simple>someNewFileName.txt</camel:simple>
</camel:setHeader>
Thanks,
Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5698676.html
Sent from the Camel - Users mailing list archive at Nabble.com.