|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.integration.file.FileReadingMessageSource
public class FileReadingMessageSource
PollableSource that creates messages from a file system directory. To prevent
messages for certain files, you may supply a FileListFilter. By
default, an AcceptOnceFileListFilter is used. It 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 would allow for this.
See for a way to do this.
| Constructor Summary | |
|---|---|
FileReadingMessageSource()
|
|
| Method Summary | |
|---|---|
void |
onFailure(Message<java.io.File> failedMessage,
java.lang.Throwable t)
In concurrent scenarios onFailure() might cause failing files to be ignored. |
void |
onSend(Message<java.io.File> sentMessage)
Callback method invoked after a message is sent successfully. |
Message<java.io.File> |
receive()
Retrieve the next available message from this source. |
void |
setFilter(FileListFilter filter)
Sets a FileFilter on the PollableSource. |
void |
setInputDirectory(org.springframework.core.io.Resource inputDirectory)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileReadingMessageSource()
| Method Detail |
|---|
public void setInputDirectory(org.springframework.core.io.Resource inputDirectory)
public void setFilter(FileListFilter filter)
FileFilter on the PollableSource. By default a
AcceptOnceFileListFilter with no bounds is used. In most cases a
customized FileFilter will be needed to deal with modification
and duplication concerns. If multiple filters are required a
CompositeFileListFilter can be used to group them together
Note that the supplied filter must be thread safe.
public Message<java.io.File> receive()
throws MessagingException
MessageSourcenull if no message is available.
receive in interface MessageSource<java.io.File>MessagingException
public void onFailure(Message<java.io.File> failedMessage,
java.lang.Throwable t)
onFailure in interface MessageDeliveryAware<java.io.File>public void onSend(Message<java.io.File> sentMessage)
MessageDeliveryAware
onSend in interface MessageDeliveryAware<java.io.File>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||