Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added temporary directory example.

...

Using a single route, it is possible to write a file to any number of subdirectories. If you have a route setup as such:

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

...

This allows you to have a single route to write files to multiple destinations.

Writing file through the temporary directory relative to the final destination

Sometime you need to temporarily write the files to some directory relative to the destination directory. Such situation usually happens when some external process with limited filtering capabilities is reading from the directory you are writing to. In the example below files will be written to the  /var/myapp/filesInProgress directory and after data transfer is done, they will be atomically moved to the /var/myapp/finalDirectory directory.

Code Block
languagejava
from("direct:start").
  to("file:///var/myapp/finalDirectory?tempPrefix=/../filesInProgress/");

Using expression for filenames

...