Reputation: 1471
Is there an option in Apache camel file component to use multiple different directory from where files can be read.
\
- home
- level1
- level2
- input (files are within this folder)
- dir1
- test
- folder1 ( set of files in this folder)
- folder2 ( set of files in this folder)
Another option is using dynamic routing, when the folders are under same directory.
But my use case i can't move files to a common directory, i need the input directory structure to be the same and as two different directories.
is there any option like below?
<from uri="file://home/leve1/level2/input,//dir1/test/folder1,//dir1/test/folder2"/>
<to ...
Upvotes: 0
Views: 899
Reputation: 909
Another thing to consider here is recursive
option which you could use along with antInclude
or include
options. In this case you will be able to poll different directories with just one consumer, e.g.
<from uri="file://dir1/test?recursive=true&antInclude=folder1/*,folder2/*" />
Note though, this would be very inefficient if you poll recursively too big file trees
Upvotes: 2
Reputation: 1879
The file
component accept 1 path as input (for context path). Instead of multiple paths in single file
component, you could consider having multiple file
component.
<from uri="file://home/leve1/level2/input" />
<to uri="direct:file-handler" />
<from uri="file://dir1/test/folder1" />
<to uri="direct:file-handler" />
<from uri="file://dir1/test/folder2" />
<to uri="direct:file-handler" />
<from uri="direct:file-handler" />
<!-- your logic goes here -->
Upvotes: 2