Merge remote-tracking branch 'upstream/master' into 4.0.0-WIP
Conflicts: spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java Resolved.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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">
|
||||
|
||||
<int-file:tail-inbound-channel-adapter id="default"
|
||||
channel="input"
|
||||
@@ -24,17 +28,28 @@
|
||||
file-delay="456"
|
||||
file="/tmp/foo"
|
||||
auto-startup="false"
|
||||
delay="${empty}"
|
||||
end="${empty}"
|
||||
reopen="${empty}"
|
||||
phase="123" />
|
||||
|
||||
<int-file:tail-inbound-channel-adapter id="apacheDefault"
|
||||
channel="input"
|
||||
native-options="${empty}"
|
||||
task-executor="exec"
|
||||
file="/tmp/bar"
|
||||
delay="2000"
|
||||
delay="${foo}"
|
||||
file-delay="10000"
|
||||
auto-startup="false"
|
||||
phase="123" />
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="foo">2000</prop>
|
||||
<prop key="empty"></prop>
|
||||
</util:properties>
|
||||
|
||||
<int-file:tail-inbound-channel-adapter id="apacheEndReopen"
|
||||
channel="input"
|
||||
task-executor="exec"
|
||||
|
||||
@@ -45,10 +45,10 @@ import org.springframework.integration.file.tail.FileTailingMessageProducerSuppo
|
||||
*/
|
||||
public class FileTailingMessageProducerTests {
|
||||
|
||||
private static final String TAIL_OPTIONS_FOLLOW_NAME_MANY_LINES = "-F -n 99999999";
|
||||
private static final String TAIL_OPTIONS_FOLLOW_NAME_ALL_LINES = "-F -n +0";
|
||||
|
||||
@Rule
|
||||
public TailRule tailRule = new TailRule(TAIL_OPTIONS_FOLLOW_NAME_MANY_LINES);
|
||||
public TailRule tailRule = new TailRule(TAIL_OPTIONS_FOLLOW_NAME_ALL_LINES);
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
@@ -76,7 +76,7 @@ public class FileTailingMessageProducerTests {
|
||||
@TailAvailable
|
||||
public void testOS() throws Exception {
|
||||
OSDelegatingFileTailingMessageProducer adapter = new OSDelegatingFileTailingMessageProducer();
|
||||
adapter.setOptions(TAIL_OPTIONS_FOLLOW_NAME_MANY_LINES);
|
||||
adapter.setOptions(TAIL_OPTIONS_FOLLOW_NAME_ALL_LINES);
|
||||
testGuts(adapter, "reader");
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,8 @@
|
||||
<section id="file-tailing">
|
||||
<title>'Tail'ing Files</title>
|
||||
<para>
|
||||
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, <classname>OSDelegatingFileTailingMessageProducer</classname>, uses the native <code>tail</code>
|
||||
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 <code>tail</code> command, the second implementation
|
||||
@@ -213,12 +214,12 @@
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[<int-file:tail-inbound-channel-adapter id="native"
|
||||
channel="input"
|
||||
native-options="-F -n 6"
|
||||
native-options="-F -n +0"
|
||||
task-executor="exec"
|
||||
file-delay=10000
|
||||
file="/tmp/foo"/>]]></programlisting>
|
||||
<para>
|
||||
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 <code>tail</code> to fail, even with
|
||||
<code>-F</code> specified), the command will be retried every 10 seconds.
|
||||
</para>
|
||||
@@ -231,11 +232,18 @@
|
||||
reopen="true"
|
||||
file-delay="10000"/>]]></programlisting>
|
||||
<para>
|
||||
This creates a commons-io <classname>Tailer</classname> adapter that examines the file for new lines every
|
||||
This creates an Apache commons-io <classname>Tailer</classname> 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 (<code>end="false"</code>) instead of the end (which is the default). The file will be
|
||||
reopened for each chunk (the default is to keep the file open).
|
||||
</para>
|
||||
<important>
|
||||
<para>
|
||||
Specifying the <code>delay</code>, <code>end</code> or <code>reopen</code> attributes,
|
||||
forces the use of the Apache commons-io adapter and the <code>native-options</code> attribute is not
|
||||
allowed.
|
||||
</para>
|
||||
</important>
|
||||
</section>
|
||||
</section>
|
||||
<section id="file-writing">
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
<para>
|
||||
The retry advice (<classname>o.s.i.handler.advice.RequestHandlerRetryAdvice</classname>)
|
||||
leverages the rich retry mechanisms provided by the
|
||||
<ulink url="https://github.com/SpringSource/spring-retry">spring-retry</ulink> project. The core component
|
||||
<ulink url="https://github.com/SpringSource/spring-retry">Spring Retry</ulink> project. The core component
|
||||
of <emphasis>spring-retry</emphasis> is the <classname>RetryTemplate</classname>, which allows configuration
|
||||
of sophisticated retry scenarios, including <classname>RetryPolicy</classname> and <classname>BackoffPolicy</classname>
|
||||
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.
|
||||
</para>
|
||||
</section>
|
||||
<para>
|
||||
<emphasis>Exception Classification for Retry</emphasis>
|
||||
|
||||
</para>
|
||||
<para>
|
||||
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 <classname>MessagingException</classname> 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.
|
||||
</para>
|
||||
<para>
|
||||
Since <emphasis>Spring Retry 1.0.3</emphasis>, the
|
||||
<classname>BinaryExceptionClassifier</classname> has a property
|
||||
<code>traverseCauses</code> (default <code>false</code>). When
|
||||
<code>true</code> it will traverse exception causes until it
|
||||
finds a match or there is no cause.
|
||||
</para>
|
||||
<para>
|
||||
To use this classifier for retry, use a <classname>SimpleRetryPolicy</classname>
|
||||
created with the constructor that takes the max attempts, the
|
||||
<interfacename>Map</interfacename> of <classname>Exception</classname>s
|
||||
and the boolean (traverseCauses), and inject this policy into the
|
||||
<classname>RetryTemplate</classname>.
|
||||
</para>
|
||||
</section>
|
||||
<section id="circuit-breaker-advice">
|
||||
<title>Circuit Breaker Advice</title>
|
||||
|
||||
Reference in New Issue
Block a user