From bdab73499dccff613627ef7712db2e1aa8433928 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 30 Mar 2012 12:59:45 -0400 Subject: [PATCH] INT-2490 (S)FTP Documentation Add (S)FTP documentation about how to disable renaming of the files during transfer --- src/reference/docbook/ftp.xml | 39 +++++++++++++++++++++++-------- src/reference/docbook/sftp.xml | 42 ++++++++++++++++++++++++++-------- 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/src/reference/docbook/ftp.xml b/src/reference/docbook/ftp.xml index b9fa7ce1ed..c93b32b2dc 100644 --- a/src/reference/docbook/ftp.xml +++ b/src/reference/docbook/ftp.xml @@ -169,11 +169,11 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp - Some times file filtering based on the simple pattern specified via filename-pattern attribute might not be + Sometimes file filtering based on the simple pattern specified via filename-pattern attribute might not be sufficient. If this is the case, you can use the filename-regex attribute to specify a Regular Expression - (e.g. filename-regex=".*\.test$"). And of course if you need complete control you can use filter + (e.g. filename-regex=".*\.test$"). And of course if you need complete control you can use filter attribute and provide a reference to any custom implementation of the - org.springframework.integration.file.filters.FileListFilter, a strategy interface for filtering a + org.springframework.integration.file.filters.FileListFilter, a strategy interface for filtering a list of files. @@ -193,11 +193,11 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp More on File Filtering and Large Files - Some times the file that just appeared in the monitored (remote) directory is not complete. Typically such a file - will be written with temporary extension (e.g., foo.txt.writing) and then renamed after the writing process finished. - As a user in most cases you are only interested in files that are complete and would like to filter only files that are complete. - To handle these scenarios you can use the filtering support provided by the filename-pattern, filename-regex - and filter attributes. Here is an example that uses a custom Filter implementation. + Sometimes the file that just appeared in the monitored (remote) directory is not complete. Typically such a file + will be written with temporary extension (e.g., foo.txt.writing) and then renamed after the writing process finished. + As a user in most cases you are only interested in files that are complete and would like to filter only files that are complete. + To handle these scenarios you can use the filtering support provided by the filename-pattern, filename-regex + and filter attributes. Here is an example that uses a custom Filter implementation. - + + + Avoiding Partially Written Files + + + One of the common problems, when dealing with file transfers, is the possibility of processing a partial file - + a file might appear in the file system before its transfer is actually complete. + + + To deal with this issue, Spring Integration FTP adapters use a very common algorithm where files are transferred + under a temporary name and then renamed once they are fully transferred. + + + By default, every file that is in the process of being transferred will appear in the file system with an additional suffix + which, by default, is .writing; this can be changed using the temporary-file-suffix attribute. + + + However, there may be situations where you don't want to use this technique (for example, if the server does not + permit renaming files). For situations like this, you can disable this feature by setting use-temporary-file-name + to false (default is true). When this attribute is false, the file is written with its + final name and the consuming application will need some other mechanism to detect that the file is completely uploaded before accessing it. +
FTP Outbound Gateway diff --git a/src/reference/docbook/sftp.xml b/src/reference/docbook/sftp.xml index e44e96b5eb..8cf96ab3be 100644 --- a/src/reference/docbook/sftp.xml +++ b/src/reference/docbook/sftp.xml @@ -100,11 +100,11 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp is the original name of the remote file (String). - Some times file filtering based on the simple pattern specified via filename-pattern attribute might not be - sufficient. If this is the case, you can use the filename-regex attribute to specify a Regular Expression - (e.g. filename-regex=".*\.test$"). And of course if you need complete control you can use the filter - attribute to provide a reference to a custom implementation of the - org.springframework.integration.file.filters.FileListFilter - a strategy interface for filtering a + Sometimes file filtering based on the simple pattern specified via filename-pattern attribute might not be + sufficient. If this is the case, you can use the filename-regex attribute to specify a Regular Expression + (e.g. filename-regex=".*\.test$"). And of course if you need complete control you can use the filter + attribute to provide a reference to a custom implementation of the + org.springframework.integration.file.filters.FileListFilter - a strategy interface for filtering a list of files. @@ -121,11 +121,11 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp More on File Filtering and Large Files - Some times a file that just appeared in the monitored (remote) directory is not complete. Typically such a file - will be written with some temporary extension (e.g., foo.txt.writing) and then renamed after the writing process completes. - As a user in most cases you are only interested in files that are complete and would like to filter only those files. - To handle these scenarios, use filtering support provided via the filename-pattern, filename-regex - and filter attributes. + Sometimes a file that just appeared in the monitored (remote) directory is not complete. Typically such a file + will be written with some temporary extension (e.g., foo.txt.writing) and then renamed after the writing process completes. + As a user in most cases you are only interested in files that are complete and would like to filter only those files. + To handle these scenarios, use filtering support provided via the filename-pattern, filename-regex + and filter attributes. If you need a custom filter implementation simply include a reference in your adapter via the filter attribute. @@ -178,6 +178,28 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp the remote-filename-generator-expression attribute with an expression value that computes the file name based on its original name while also appending a suffix: '-foo'. + + + Avoiding Partially Written Files + + + One of the common problems, when dealing with file transfers, is the possibility of processing a partial file - + a file might appear in the file system before its transfer is actually complete. + + + To deal with this issue, Spring Integration SFTP adapters use a very common algorithm where files are transferred + under a temporary name and than renamed once they are fully transferred. + + + By default, every file that is in the process of being transferred will appear in the file system with an additional suffix + which, by default, is .writing; this can be changed using the temporary-file-suffix attribute. + + + However, there may be situations where you don't want to use this technique (for example, if the server does not + permit renaming files). For situations like this, you can disable this feature by setting use-temporary-file-name + to false (default is true). When this attribute is false, the file is written with its + final name and the consuming application will need some other mechanism to detect that the file is completely uploaded before accessing it. +