GH-3557: Add maxDepth, dirPredicate to FileReadMS (#8596)

* GH-3557: Add maxDepth, dirPredicate to FileReadMS

Fixes https://github.com/spring-projects/spring-integration/issues/3557

* Expose a `watchMaxDepth` on the `FileReadingMessageSource` for its `Files.walkFileTree()` API usage
* Add `watchDirPredicate` option ot the `FileReadingMessageSource` to skip sub-tree for `Files.walkFileTree()`
scanning according to some condition against directory `Path`

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
This commit is contained in:
Artem Bilan
2023-04-13 17:03:39 -04:00
committed by GitHub
parent aaaa489f0c
commit 053cc00484
5 changed files with 156 additions and 74 deletions

View File

@@ -386,6 +386,11 @@ The following example shows how to configure different logic for create and modi
----
====
Starting with version 6.1, the `FileReadingMessageSource` exposes two new `WatchService`-related options:
* `watchMaxDepth` - an argument for the `Files.walkFileTree(Path root, Set attributes, int maxDepth, FileVisitor visitor)` API;
* `watchDirPredicate` - a `Predicate<Path>` to test if a directory in the scanned tree should be walked and registered with the `WatchService` and the configured watch event kinds.
==== Limiting Memory Consumption
You can use a `HeadDirectoryScanner` to limit the number of files retained in memory.

View File

@@ -63,3 +63,9 @@ See <<./jms.adoc#jms-inbound-gateway, JMS Inbound Gateway>> for more information
The (previously deprecated) `ImapIdleChannelAdapter.sendingTaskExecutor` property has been removed in favor of an asynchronous message process downstream in the flow.
See <<./mail.adoc#mail-inbound, Mail-receiving Channel Adapter>> for more information.
[[x6.1-file]]
=== Files Changes
The `FileReadingMessageSource` now exposes `watchMaxDepth` and `watchDirPredicate` options for the `WatchService`.
See <<./file.adoc#watch-service-directory-scanner, `WatchServiceDirectoryScanner`>> for more information.