You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@yahoo.com> on 2008/12/11 03:35:29 UTC

FileComponent.HEADER_FILE_NAME usage

Hello All,
I have a method that is writing out files to multiple destinations.  Rather
than configure a route for each destination, I would like to use a single
bean and route to do it.  I set up a route like this for example:

  <route>
    <from uri="bean:myBean"/>
    <to uri="file:/rootDirectory"/>
  </route>

Then in 'myBean', I set the FileComponent.HEADER_FILE_NAME to be something
like 'subdirectory1/subdirectory2/myFileName.xml'.  The file is then written
to /rootDirectory/subdirectory1/subdirectory2/myFileName.xml.

This works great and allows me to write to many different subfolders of
'rootDirectory' with a single bean.  Was this the way the Camel File
component was intended to be used or am I just hacking this improperly?

If this is correct, let me know if this would be something worth including
on the wiki:
http://activemq.apache.org/camel/file.html

Thanks,
Yogesh
-- 
View this message in context: http://www.nabble.com/FileComponent.HEADER_FILE_NAME-usage-tp20948456s22882p20948456.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: FileComponent.HEADER_FILE_NAME usage

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 11, 2008 at 3:35 AM, ychawla <pr...@yahoo.com> wrote:
>
> Hello All,
> I have a method that is writing out files to multiple destinations.  Rather
> than configure a route for each destination, I would like to use a single
> bean and route to do it.  I set up a route like this for example:
>
>  <route>
>    <from uri="bean:myBean"/>
>    <to uri="file:/rootDirectory"/>
>  </route>
>
> Then in 'myBean', I set the FileComponent.HEADER_FILE_NAME to be something
> like 'subdirectory1/subdirectory2/myFileName.xml'.  The file is then written
> to /rootDirectory/subdirectory1/subdirectory2/myFileName.xml.
>
> This works great and allows me to write to many different subfolders of
> 'rootDirectory' with a single bean.  Was this the way the Camel File
> component was intended to be used or am I just hacking this improperly?
>
> If this is correct, let me know if this would be something worth including
> on the wiki:
> http://activemq.apache.org/camel/file.html
Yes you are doing it correctly. The FileComponent.HEADER_FILE_NAME is
to be used to set explicit the filename you want files to be written
as.


FileComponent.HEADER_FILE_NAME = hello.txt => /rootDirectory/hello.txt
FileComponent.HEADER_FILE_NAME = foo/bye.txt => /rootDirectory/foo/bye.txt

Yes please fell free to write about this on the camel-file wiki page.
This component has many options and is flexible but the wiki could use
a brush with a few more examples.

>
> Thanks,
> Yogesh
> --
> View this message in context: http://www.nabble.com/FileComponent.HEADER_FILE_NAME-usage-tp20948456s22882p20948456.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Re: FileComponent.HEADER_FILE_NAME usage

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jan 9, 2009 at 11:06 PM, ychawla <pr...@yahoo.com> wrote:
>
> Thanks for the help Claus.  I just updated the WIKI with the example in this
> thread.
Thanks a lot your update on the wiki is great.

> --
> View this message in context: http://www.nabble.com/FileComponent.HEADER_FILE_NAME-usage-tp20948456s22882p21381428.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/

Re: FileComponent.HEADER_FILE_NAME usage

Posted by ychawla <pr...@yahoo.com>.
Thanks for the help Claus.  I just updated the WIKI with the example in this
thread.
-- 
View this message in context: http://www.nabble.com/FileComponent.HEADER_FILE_NAME-usage-tp20948456s22882p21381428.html
Sent from the Camel - Users mailing list archive at Nabble.com.