Apache Camel 2.10.7 - monitor deletion of files fr

2019-09-02 12:11发布

I am using camel 2.10.7 with great success from servicemix to feed files from the local file system to my application.

The files shall remain on the file system, hence I use a configuration like this one.

from uri="file:../ange-data/vessels?noop=true&idempotentKey=${file:name}-${file:modified}"

This works great if I touch/update a file on the file system.

Only issue remains: how can I then in my Java code detect that a file has been removed from the file system by some other person or process?

Could not find any hint by studying the manual pages http://camel.apache.org/file-language.html or http://camel.apache.org/file2.html - but I believe it should be possible to get a message on file deletion?

1条回答
Anthone
2楼-- · 2019-09-02 12:44

You would need to use Java 7 nio2 which has a file watcher api where you can get notifications when files are added/removed etc.

Search the web / SO for details on this api, for example

查看更多
登录 后发表回答