How can Apache Camel be used to monitor file changes?

后端 未结 5 1776
孤街浪徒
孤街浪徒 2020-12-10 02:09

I would like to monitor all of the files in a given directory for changes, ie an updated timestamp. This use case seems natural for Camel using the file component, but I can

5条回答
  •  爱一瞬间的悲伤
    2020-12-10 02:36

    I don't think Camel supports that specific feature but with the existent options you can come up with a similar solution of monitoring a directory.

    What you need to do is set a small delay value to check the directory and maintain a repository of the already read files. Depending on how you configure the repository (by size, by filename, by a mix of them...) this solution would be able to provide you information about news files and modified files. As a caveat it would be consuming the files in the directory very often.

    Maybe you could use other solutions different from Camel like Apache Commons VFS2 (I wrote a explanation about how to use it for this scenario: WatchService locks some files?

提交回复
热议问题