Complete - task 6: Create PollableFileSource

Last review done by Mark and Arjen, modification time concern pushed out.
Added parameter to MessageDeliveryAware
This commit is contained in:
Iwein Fuld
2008-09-11 13:40:12 +00:00
parent 61ed767cdb
commit 0f9dc8c750
10 changed files with 145 additions and 188 deletions

View File

@@ -37,7 +37,7 @@ import org.springframework.util.Assert;
* @author Marius Bogoevici
* @author Iwein Fuld
*/
public abstract class AbstractDirectorySource<T> implements PollableSource<T>, MessageDeliveryAware {
public abstract class AbstractDirectorySource<T> implements PollableSource<T>, MessageDeliveryAware<T> {
public final static String FILE_INFO_PROPERTY = "file.info";
@@ -99,14 +99,14 @@ public abstract class AbstractDirectorySource<T> implements PollableSource<T>, M
return this.messageCreator.createMessage(retrieveNextPayload());
}
public void onSend(Message<?> message) {
public void onSend(Message<T> message) {
if (logger.isDebugEnabled()) {
logger.debug(message + " processed successfully. Files will be removed from backlog");
}
this.backlog.processed();
}
public void onFailure(Message<?> failedMessage, Throwable exception) {
public void onFailure(Message<T> failedMessage, Throwable exception) {
if (this.logger.isWarnEnabled()) {
this.logger.warn("Failure notification received by [" + this.getClass().getSimpleName() + "] for message: "
+ failedMessage + ". Selected files will be moved back to the backlog.", exception);

View File

@@ -35,11 +35,13 @@ import org.springframework.util.Assert;
/**
* A messaging source that polls a directory to retrieve files.
*
* @deprecated Replaced by org.springframework.integration.file.PollableFileSource.
*
* @author Mark Fisher
* @author Marius Bogoevici
* @author Iwein Fuld
*/
public class FileSource extends AbstractDirectorySource<File> implements MessageDeliveryAware {
public class FileSource extends AbstractDirectorySource<File> implements MessageDeliveryAware<File> {
private final File directory;