0

I have a requirement where i have to aggregate/merge 6 xml files to a single xml file using Apache Camel. The issue is that, the 6 xml files are mounted on a folder which 6 different servers will be polling. So, if each server picks up one file and locks it, how can i , merge and create a single xml file?

The complexity is how to write to a single file when there are six servers processing all the six files mounted to the folder.

Please help with a solution if someone faced a similr problem.

Thanks

chand
  • 11
  • 3
  • Maybe you can implement your own GenericFileProcessStrategy where you check if one of the 6 files has a lock file and then you stop consuming. Would be interesting how you find out which files belong together. – soilworker Apr 30 '15 at 12:52

1 Answers1

0

From the camel documentation http://camel.apache.org/file2.html

fileLock is for using java.nio.channels.FileLock. 
This option is not avail for the FTP component. This approach should be avoided when accessing a remote file system via a mount/share unless that file system supports distributed file locks. 

So this should help with the file locking scenario.

Now for the next step, it's possible to implement a custom aggregation strategy with an aggregationrepository this way the consumer is idempotent.

Ashoka
  • 935
  • 7
  • 20
  • Can you ellaborate?? I have actually written an aggregation strategy to combine the xmls.. – chand May 04 '15 at 12:02