diff --git a/spring-integration-reference/src/file.xml b/spring-integration-reference/src/file.xml new file mode 100644 index 0000000000..43504bbb83 --- /dev/null +++ b/spring-integration-reference/src/file.xml @@ -0,0 +1,125 @@ + + + + Dealing with Files + +
+ Introduction + + Spring Integration File extends the Spring Integration Core with + dedicated + vocabulary to deal with reading, writing and transforming + files. + There is a namespace that enables elements that define channel + adapters dedicated to files and support for transformers that + transform files into strings or byte arrays. + + + This section will explain the workings of + PollableFileSource + , + FileWritingMessageConsumer + + and how to configure them as + beans + . Also the support for dealing with files through file specific + implementations of + Transformer + will be discussed. Finally the file specific namespace will be + discussed. + +
+ +
+ Reading Files + + A + PollableFileSource + can be used to consume files from the filesystem. This is an + implementation of + PollableSource + that creates messages from a file system directory. + ]]> + + + To prevent creating messages for certain files, you may supply a + {@link FileListFilter}. By default, an + AcceptOnceFileListFilter + + is used. This filter ensures files are picked up only once from the + directory. + ]]> + + + 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 pattern-matching filter that accepts only files that are + ready (e.g. based on a known suffix), composed with the default + AcceptOnceFileListFilter + + allows for this. + + + + + + + + + + + ]]> + + + The configuration can be simplified using the file specific + namespace. To do this use the following template. + + +]]> + Within this namespace you can reduce the PollableFileSource and wrap + it in a InboundChannelAdapter like this: + + (1) + (2) + (3) + ]]> + + +
+
+ Writing files + + + + + + + + + +
+
\ No newline at end of file