Adds the 'timeout' attribute on <aggregator/> (INT-139)

This commit is contained in:
Marius Bogoevici
2008-03-07 06:18:23 +00:00
parent c71412d6d5
commit c602050df6
4 changed files with 14 additions and 6 deletions

View File

@@ -57,6 +57,8 @@ public class AggregatorParser implements BeanDefinitionParser {
public static final String TRACKED_CORRELATION_ID_CAPACITY_ATTRIBUTE = "tracked-correlation-id-capacity";
public static final String TIMEOUT_ATTRIBUTE = "timeout";
private static final String COMPLETION_STRATEGY_PROPERTY = "completionStrategy";
private static final String DEFAULT_REPLY_CHANNEL_PROPERTY = "defaultReplyChannel";
@@ -71,12 +73,13 @@ public class AggregatorParser implements BeanDefinitionParser {
public static final String TRACKED_CORRELATION_ID_CAPACITY_PROPERTY = "trackedCorrelationIdCapacity";
public static final String TIMEOUT = "timeout";
public BeanDefinition parse(Element element, ParserContext parserContext) {
return parseAggregatorElement(element, parserContext, true);
}
private BeanDefinition parseAggregatorElement(Element element, ParserContext parserContext, boolean topLevel) {
final RootBeanDefinition aggregatorDef = new RootBeanDefinition(AggregatingMessageHandler.class);
aggregatorDef.setSource(parserContext.extractSource(element));
@@ -116,6 +119,7 @@ public class AggregatorParser implements BeanDefinitionParser {
REAPER_INTERVAL_ATTRIBUTE);
IntegrationNamespaceUtils.setValueIfAttributeDefined(aggregatorDef, TRACKED_CORRELATION_ID_CAPACITY_PROPERTY,
element, TRACKED_CORRELATION_ID_CAPACITY_ATTRIBUTE);
IntegrationNamespaceUtils.setValueIfAttributeDefined(aggregatorDef, TIMEOUT, element, TIMEOUT_ATTRIBUTE);
String beanName = StringUtils.hasText(id) ? id : parserContext.getReaderContext().generateBeanName(
aggregatorDef);
parserContext.registerBeanComponent(new BeanComponentDefinition(aggregatorDef, beanName));

View File

@@ -243,6 +243,7 @@
<xsd:attribute name="send-partial-result-on-timeout" type="xsd:boolean" use="optional"/>
<xsd:attribute name="tracked-correlation-id-capacity" type="xsd:int" use="optional"/>
<xsd:attribute name="reaper-interval" type="xsd:long" use="optional"/>
<xsd:attribute name="timeout" type="xsd:long" use="optional"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

View File

@@ -99,6 +99,8 @@ public class AggregatorParserTests {
Assert.assertEquals(
"The AggregatingMessageHandler is not configured with the appropriate tracked correlationId capacity",
99, getPropertyValue(completeAggregatingMessageHandler, "trackedCorrelationIdCapacity", int.class));
Assert.assertEquals("The AggregatingMessageHandler is not configured with the appropriate timeout",
42l, getPropertyValue(completeAggregatingMessageHandler, "timeout", long.class));
}
@Test

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd">
<aggregator id="aggregatorWithReference" ref="aggregatorBean"/>
@@ -17,7 +17,8 @@
send-timeout="86420000"
send-partial-result-on-timeout="true"
reaper-interval="135"
tracked-correlation-id-capacity="99"/>
tracked-correlation-id-capacity="99"
timeout="42"/>
<aggregator id="aggregatorWithReferenceAndMethod" ref="adderBean" method="add" default-reply-channel="replyChannel"/>
@@ -29,6 +30,6 @@
<beans:bean id="adderBean" class="org.springframework.integration.config.Adder"/>
<beans:bean id="completionStrategy" class="org.springframework.integration.config.TestCompletionStrategy"/>
<beans:bean id="completionStrategy" class="org.springframework.integration.config.TestCompletionStrategy"/>
</beans:beans>