INT-674 Added support for the "timeout" attribute to the <router/> element.

This commit is contained in:
Mark Fisher
2009-06-19 19:00:45 +00:00
parent 0f8f07a47f
commit 5121c8262e
4 changed files with 33 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,9 @@ public class RouterFactoryBean extends AbstractMessageHandlerFactoryBean {
private volatile ChannelResolver channelResolver;
private volatile MessageChannel defaultOutputChannel;
private volatile Long timeout;
private volatile Boolean resolutionRequired;
private volatile Boolean ignoreChannelNameResolutionFailures;
@@ -50,6 +52,10 @@ public class RouterFactoryBean extends AbstractMessageHandlerFactoryBean {
this.defaultOutputChannel = defaultOutputChannel;
}
public void setTimeout(Long timeout) {
this.timeout = timeout;
}
public void setResolutionRequired(Boolean resolutionRequired) {
this.resolutionRequired = resolutionRequired;
}
@@ -65,6 +71,9 @@ public class RouterFactoryBean extends AbstractMessageHandlerFactoryBean {
if (this.defaultOutputChannel != null) {
router.setDefaultOutputChannel(this.defaultOutputChannel);
}
if (this.timeout != null) {
router.setTimeout(timeout.longValue());
}
if (this.ignoreChannelNameResolutionFailures != null) {
Assert.isTrue(router instanceof AbstractChannelNameResolvingMessageRouter,
"The 'ignoreChannelNameResolutionFailures' property can only be set on routers that extend "

View File

@@ -33,6 +33,7 @@ public abstract class AbstractRouterParser extends AbstractConsumerEndpointParse
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
IntegrationNamespaceUtils.BASE_PACKAGE + ".config.RouterFactoryBean");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "default-output-channel");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "timeout");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "resolution-required");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-channel-name-resolution-failures");
this.parseRouter(element, builder, parserContext);