diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java index f490d08c2e..46d6acce11 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java @@ -185,6 +185,8 @@ public class ConsumerEndpointFactoryBean pollingConsumer.setAdviceChain(this.pollerMetadata.getAdviceChain()); pollingConsumer.setMaxMessagesPerPoll(this.pollerMetadata.getMaxMessagesPerPoll()); + pollingConsumer.setErrorHandler(this.pollerMetadata.getErrorHandler()); + pollingConsumer.setReceiveTimeout(this.pollerMetadata.getReceiveTimeout()); pollingConsumer.setBeanClassLoader(beanClassLoader); pollingConsumer.setBeanFactory(beanFactory); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel-context.xml index 3b30bfa697..51477e12d4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel-context.xml @@ -33,6 +33,14 @@ + + + + + + + + @@ -40,4 +48,8 @@ + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannelTests.java index 20f508db01..aeb181491a 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannelTests.java @@ -26,10 +26,13 @@ import org.mockito.Mockito; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.MessageChannel; +import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.core.MessageHandler; import org.springframework.integration.core.PollableChannel; import org.springframework.integration.core.SubscribableChannel; import org.springframework.integration.endpoint.SourcePollingChannelAdapter; +import org.springframework.integration.message.GenericMessage; /** * @author Oleg Zhurakousky @@ -87,6 +90,16 @@ public class PollerWithErrorChannelTests { adapter.stop(); } + @Test + // INT-1952 + public void testWithErrorChannelAndPollingConsumer() throws Exception{ + ApplicationContext ac = new ClassPathXmlApplicationContext("PollerWithErrorChannel-context.xml", this.getClass()); + MessageChannel serviceWithPollerChannel = ac.getBean("serviceWithPollerChannel", MessageChannel.class); + QueueChannel errChannel = ac.getBean("serviceErrorChannel", QueueChannel.class); + serviceWithPollerChannel.send(new GenericMessage("")); + assertNotNull(errChannel.receive(1000)); + } + public static class SampleService{ public String withSuccess(){ return "hello";