diff --git a/build.gradle b/build.gradle
index f47e8453af..9f3e11d0e7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -70,7 +70,7 @@ subprojects { subproject ->
springSecurityVersion = '3.1.3.RELEASE'
springSocialTwitterVersion = '1.0.5.RELEASE'
springWsVersion = '2.1.1.RELEASE'
- springRetryVersion = '1.0.2.RELEASE'
+ springRetryVersion = '1.0.3.RELEASE'
}
eclipse {
diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterFactoryBean.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterFactoryBean.java
index 9534953d4e..2ffa6c51a3 100644
--- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterFactoryBean.java
+++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterFactoryBean.java
@@ -28,6 +28,7 @@ import org.springframework.integration.file.tail.ApacheCommonsFileTailingMessage
import org.springframework.integration.file.tail.FileTailingMessageProducerSupport;
import org.springframework.integration.file.tail.OSDelegatingFileTailingMessageProducer;
import org.springframework.scheduling.TaskScheduler;
+import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
@@ -67,7 +68,9 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
private volatile ApplicationEventPublisher applicationEventPublisher;
public void setNativeOptions(String nativeOptions) {
- this.nativeOptions = nativeOptions;
+ if (StringUtils.hasText(nativeOptions)) {
+ this.nativeOptions = nativeOptions;
+ }
}
public void setFile(File file) {
@@ -82,11 +85,11 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
this.taskScheduler = taskScheduler;
}
- public void setDelay(long delay) {
+ public void setDelay(Long delay) {
this.delay = delay;
}
- public void setFileDelay(long fileDelay) {
+ public void setFileDelay(Long fileDelay) {
this.fileDelay = fileDelay;
}
@@ -107,11 +110,11 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
this.outputChannel = outputChannel;
}
- public void setAutoStartup(boolean autoStartup) {
+ public void setAutoStartup(Boolean autoStartup) {
this.autoStartup = autoStartup;
}
- public void setPhase(int phase) {
+ public void setPhase(Integer phase) {
this.phase = phase;
}
@@ -180,9 +183,8 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
}
}
else {
- if (this.nativeOptions != null && StringUtils.hasText(this.nativeOptions) && logger.isWarnEnabled()) {
- logger.warn("'native-options' are ignored with an Apache commons-io 'Tailer' adapter");
- }
+ Assert.isTrue(this.nativeOptions == null,
+ "'native-options' is not allowed with 'delay', 'end', or 'reopen'");
adapter = new ApacheCommonsFileTailingMessageProducer();
if (this.delay != null) {
((ApacheCommonsFileTailingMessageProducer) adapter).setPollingDelay(this.delay);
diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests-context.xml b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests-context.xml
index 60b7ebc22b..7a26ed9948 100644
--- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests-context.xml
+++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterParserTests-context.xml
@@ -4,10 +4,14 @@
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:int="http://www.springframework.org/schema/integration"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+
+
+
+ 2000
+
+
+
'Tail'ing Files
- Another popular use case is to get 'lines' from the end (or tail) of a file. Two implementations are provided;
+ Another popular use case is to get 'lines' from the end (or tail) of a file, capturing new lines when
+ they are added. Two implementations are provided;
the first, OSDelegatingFileTailingMessageProducer, uses the native tail
command (on operating systems that have one). This is likely the most efficient implementation on those
platforms. For operating systems that do not have a tail command, the second implementation
@@ -213,12 +214,12 @@
]]>
- This creates a native adapter with '-F -n 6' options (follow the file name, emit up to 6 lines before the current end).
+ This creates a native adapter with '-F -n +0' options (follow the file name, emitting all existing lines).
If the tail command fails (on some platforms, a missing file causes the tail to fail, even with
-F specified), the command will be retried every 10 seconds.
@@ -231,11 +232,18 @@
reopen="true"
file-delay="10000"/>]]>
- This creates a commons-io Tailer adapter that examines the file for new lines every
+ This creates an Apache commons-io Tailer adapter that examines the file for new lines every
2 seconds, and checks for existence of a missing file every 10 seconds. The file will be tailed from the
beginning (end="false") instead of the end (which is the default). The file will be
reopened for each chunk (the default is to keep the file open).
+
+
+ Specifying the delay, end or reopen attributes,
+ forces the use of the Apache commons-io adapter and the native-options attribute is not
+ allowed.
+
+
diff --git a/src/reference/docbook/handler-advice.xml b/src/reference/docbook/handler-advice.xml
index 91fb6b1175..8a7a25e383 100644
--- a/src/reference/docbook/handler-advice.xml
+++ b/src/reference/docbook/handler-advice.xml
@@ -78,7 +78,7 @@
The retry advice (o.s.i.handler.advice.RequestHandlerRetryAdvice)
leverages the rich retry mechanisms provided by the
- spring-retry project. The core component
+ Spring Retry project. The core component
of spring-retry is the RetryTemplate, which allows configuration
of sophisticated retry scenarios, including RetryPolicy and BackoffPolicy
strategies, with a number of implementations,
@@ -288,6 +288,32 @@ Caused by: java.lang.RuntimeException: foo
exception is thrown to the caller on each failure.
+
+ Exception Classification for Retry
+
+
+
+ Spring Retry has a great deal of flexibility for determining which
+ exceptions can invoke retry. The default configuration will retry
+ for all exceptions. Given that, user exceptions may be wrapped in
+ a MessagingException in the underlying handler,
+ we need to ensure that the classification examines the exception causes.
+ The default classifier just looks at the top level exception.
+
+
+ Since Spring Retry 1.0.3, the
+ BinaryExceptionClassifier has a property
+ traverseCauses (default false). When
+ true it will traverse exception causes until it
+ finds a match or there is no cause.
+
+
+ To use this classifier for retry, use a SimpleRetryPolicy
+ created with the constructor that takes the max attempts, the
+ Map of Exceptions
+ and the boolean (traverseCauses), and inject this policy into the
+ RetryTemplate.
+