camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Dynamic origin file components?
Date Fri, 28 May 2010 11:10:16 GMT

Its probably just much easier to create a for the file
name and then send that as a body to the given FTP endpoint.
Then you do NOT need any camel routes at all.

And the file will thus be kept as it was.

ProducerTemplate template = ...
File target = new File("the file name here");

template.sendBodyAndHeader(ftpEndpointHere, target,
Exchange.FILE_NAME, "the file name to be written on the ftp server");

On Fri, May 28, 2010 at 12:58 PM, Mattias Severson <> wrote:
> Is it possible to create file components dynamically?
> I have an interface that gives me File objects (after a physical file has
> been created on disk) that I would like to send to a remote FTP address. The
> files are created one at the time, in different folders and with different
> file names. The files should only be sent once and should also remain on the
> origin location after they have been sent, e.g. by using the noop option.
> void sendViaFtp(File file, String userName, String host) {
>    from(getFileUri(file)).to(getFtpUri(userName, host, file));
> }
> private static String getFileUri(File file) {
>    return String.format("file://%s?fileName=%s?noop=true",
> filenameUtils.getPath(file.getAbsolutePath()), file.getName());
> }
> private static String getFtpUri(String userName, String host, File file) {
>    return String.format("ftp://%s@%s/%s", userName, host, file.getName());
> }
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Apache Camel Committer

Author of Camel in Action:
Open Source Integration:

View raw message