...
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 |
|
<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 |
|
from("direct:start").
to("file:///var/myapp/finalDirectory?tempPrefix=/../filesInProgress/");
|
Using _expression_ for filenames
...