INT-4204: Introduce ExpressionFileListFilter
JIRA: https://jira.spring.io/browse/INT-4204 Fix error message in the `AbstractRemoteFileOutboundGatewayParser`
This commit is contained in:
committed by
Gary Russell
parent
33b60c9601
commit
9836828f54
@@ -69,7 +69,7 @@ metadata store on every update (if the store implements `Flushable`).
|
||||
A common problem with reading files is that a file may be detected before it is ready.
|
||||
The default `AcceptOnceFileListFilter` does not prevent this.
|
||||
In most cases, this can be prevented if the file-writing process renames each file as soon as it is ready for reading.
|
||||
A filename-pattern or filename-regex filter that accepts only files that are ready (e.g.
|
||||
A `filename-pattern` or `filename-regex` filter that accepts only files that are ready (e.g.
|
||||
based on a known suffix), composed with the default `AcceptOnceFileListFilter` allows for this.
|
||||
The `CompositeFileListFilter` enables the composition.
|
||||
[source,xml]
|
||||
@@ -106,6 +106,16 @@ to, say, network glitches.
|
||||
</bean>
|
||||
----
|
||||
|
||||
Starting with _version 5.0_ an `ExpressionFileListFilter` has been introduced to allow to execute SpEL expression against file as a context evaluation root object.
|
||||
For this purpose all the XML components for file handling (local and remote), alongside with an existing `filter` attribute, have been supplied with the `filter-expression` option:
|
||||
[source, xml]
|
||||
----
|
||||
<int-file:inbound-channel-adapter
|
||||
directory="${inputdir}"
|
||||
filter-expression="name matches '.text'"
|
||||
auto-startup="false"/>
|
||||
----
|
||||
|
||||
*Message Headers*
|
||||
|
||||
Starting with _version 5.0_ the `FileReadingMessageSource`, in addition to the `payload` as a polled `File`, populates these headers to the outbound `Message`:
|
||||
|
||||
@@ -516,6 +516,7 @@ See <<file-splitter>> and <<stream-transformer>> for more information about thes
|
||||
filename-pattern="*.txt"
|
||||
filename-regex=".*\.txt"
|
||||
filter="filter"
|
||||
filter-expression="@myFilterBean.check(#root)"
|
||||
remote-file-separator="/"
|
||||
comparator="comparator"
|
||||
max-fetch-size="1"
|
||||
@@ -524,7 +525,7 @@ See <<file-splitter>> and <<stream-transformer>> for more information about thes
|
||||
</int-ftp:inbound-streaming-channel-adapter>
|
||||
----
|
||||
|
||||
Only one of `filename-pattern`, `filename-regex` or `filter` is allowed.
|
||||
Only one of `filename-pattern`, `filename-regex`, `filter` or `filter-expression` is allowed.
|
||||
|
||||
IMPORTANT: Unlike the non-streaming inbound channel adapter, this adapter does not prevent duplicates by default.
|
||||
If you do not delete the remote file (e.g. using an outbound gateway with an rm command) and you wish to prevent the
|
||||
@@ -911,7 +912,7 @@ _mput_ sends multiple files to the server and supports the following option:
|
||||
The message payload must be a `java.io.File` representing a local directory.
|
||||
|
||||
The same attributes as the `put` command are supported.
|
||||
In addition, files in the local directory can be filtered with one of `mput-pattern`, `mput-regex` or `mput-filter`.
|
||||
In addition, files in the local directory can be filtered with one of `mput-pattern`, `mput-regex`, `mput-filter` or `mput-filter-expression`.
|
||||
The filter works with recursion, as long as the subdirectories themselves pass the filter.
|
||||
Subdirectories that do not pass the filter are not recursed.
|
||||
|
||||
|
||||
@@ -555,6 +555,7 @@ See <<file-splitter>> and <<stream-transformer>> for more information about thes
|
||||
filename-pattern="*.txt"
|
||||
filename-regex=".*\.txt"
|
||||
filter="filter"
|
||||
filter-expression="@myFilterBean.check(#root)"
|
||||
remote-file-separator="/"
|
||||
comparator="comparator"
|
||||
max-fetch-size="1"
|
||||
@@ -563,7 +564,7 @@ See <<file-splitter>> and <<stream-transformer>> for more information about thes
|
||||
</int-sftp:inbound-streaming-channel-adapter>
|
||||
----
|
||||
|
||||
Only one of `filename-pattern`, `filename-regex` or `filter` is allowed.
|
||||
Only one of `filename-pattern`, `filename-regex`, `filter` or `filter-expression` is allowed.
|
||||
|
||||
IMPORTANT: Unlike the non-streaming inbound channel adapter, this adapter does not prevent duplicates by default.
|
||||
If you do not delete the remote file (e.g. using an outbound gateway with an rm command) and you wish to prevent the
|
||||
@@ -935,7 +936,7 @@ _mput_ sends multiple files to the server and supports the following option:
|
||||
The message payload must be a `java.io.File` representing a local directory.
|
||||
|
||||
The same attributes as the `put` command are supported.
|
||||
In addition, files in the local directory can be filtered with one of `mput-pattern`, `mput-regex` or `mput-filter`.
|
||||
In addition, files in the local directory can be filtered with one of `mput-pattern`, `mput-regex`, `mput-filter` or `mput-filter-expression`.
|
||||
The filter works with recursion, as long as the subdirectories themselves pass the filter.
|
||||
Subdirectories that do not pass the filter are not recursed.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user