diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java index 925ecba2cc..3f084c80ea 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java @@ -47,6 +47,8 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean source) { this.source = source; } + + public void setSendTimeout(long sendTimeout) { + this.sendTimeout = sendTimeout; + } public void setOutputChannel(MessageChannel outputChannel) { this.outputChannel = outputChannel; @@ -130,6 +136,7 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean + + + + Maximum amount of time in milliseconds to wait when sending a message to the channel if such channel + is a Queue Channel since Queue Channel is the only channel that has the concept capacity. If maximum capasity is reached + the messages will be rejected by the Queue Channel. + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml index 36ee9b377d..20ae14f62a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration - http://www.springframework.org/schema/integration/spring-integration.xsd"> + http://www.springframework.org/schema/integration/spring-integration-2.0.xsd"> @@ -19,9 +19,19 @@ - + + + + + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java index 17f7674fd4..7b55192c93 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java @@ -36,6 +36,7 @@ import org.springframework.integration.endpoint.SourcePollingChannelAdapter; import org.springframework.integration.message.GenericMessage; import org.springframework.integration.support.channel.BeanFactoryChannelResolver; import org.springframework.integration.support.channel.ChannelResolutionException; +import org.springframework.integration.test.util.TestUtils; /** * @author Mark Fisher @@ -220,6 +221,17 @@ public class ChannelAdapterParserTests { BeanFactoryChannelResolver channelResolver = new BeanFactoryChannelResolver(this.applicationContext); channelResolver.resolveChannelName("methodInvokingSource"); } + + @Test + public void methodInvokingSourceWithSendTimeout() throws Exception{ + String beanName = "methodInvokingSourceWithTimeout"; + + SourcePollingChannelAdapter adapter = + this.applicationContext.getBean(beanName, SourcePollingChannelAdapter.class); + assertNotNull(adapter); + long sendTimeout = TestUtils.getPropertyValue(adapter, "messagingTemplate.sendTimeout", Long.class); + assertEquals(999, sendTimeout); + } public static class SampleBean{ private String message = "hello";