INT-1952 fixed ConsumerEndpointFactoryBean to ensure the Polling Consumer is created with propper ErrorHandler
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -33,6 +33,14 @@
|
||||
|
||||
<int:service-activator input-channel="serviceChannel" expression="payload/0"/>
|
||||
|
||||
<int:channel id="serviceWithPollerChannel">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int:service-activator input-channel="serviceWithPollerChannel" expression="5/0">
|
||||
<int:poller fixed-rate="1000" error-channel="serviceErrorChannel"/>
|
||||
</int:service-activator>
|
||||
|
||||
<int:channel id="eChannel">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
@@ -40,4 +48,8 @@
|
||||
<int:channel id="errChannel">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int:channel id="serviceErrorChannel">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
</beans>
|
||||
|
||||
@@ -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<String>(""));
|
||||
assertNotNull(errChannel.receive(1000));
|
||||
}
|
||||
|
||||
public static class SampleService{
|
||||
public String withSuccess(){
|
||||
return "hello";
|
||||
|
||||
Reference in New Issue
Block a user