diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/ChannelAdapterParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/ChannelAdapterParser.java index 52a82ac0ee..a8b02edb1b 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/ChannelAdapterParser.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/ChannelAdapterParser.java @@ -75,10 +75,10 @@ public class ChannelAdapterParser extends AbstractBeanDefinitionParser { adapterBuilder = BeanDefinitionBuilder.genericBeanDefinition(InboundChannelAdapter.class); adapterBuilder.addPropertyReference("source", source); if (StringUtils.hasText(channelName)) { - adapterBuilder.addPropertyReference("channel", channelName); + adapterBuilder.addPropertyReference("outputChannel", channelName); } else { - adapterBuilder.addPropertyReference("channel", this.createDirectChannel(element, parserContext)); + adapterBuilder.addPropertyReference("outputChannel", this.createDirectChannel(element, parserContext)); } if (pollerElement != null) { IntegrationNamespaceUtils.configureSchedule(pollerElement, adapterBuilder); diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/annotation/ChannelAdapterAnnotationPostProcessor.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/annotation/ChannelAdapterAnnotationPostProcessor.java index bee1d2446b..780d540f17 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/annotation/ChannelAdapterAnnotationPostProcessor.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/annotation/ChannelAdapterAnnotationPostProcessor.java @@ -90,7 +90,7 @@ public class ChannelAdapterAnnotationPostProcessor implements MethodAnnotationPo Schedule schedule = this.createSchedule(pollerAnnotation); InboundChannelAdapter adapter = new InboundChannelAdapter(); adapter.setSource(source); - adapter.setChannel(channel); + adapter.setOutputChannel(channel); adapter.setSchedule(schedule); adapter.setBeanName(this.generateUniqueName(channel.getName() + ".inboundAdapter")); return adapter; diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractMessageProducingEndpoint.java b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractMessageProducingEndpoint.java index 222d80c16b..3a73cfdd31 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractMessageProducingEndpoint.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/AbstractMessageProducingEndpoint.java @@ -32,6 +32,10 @@ public class AbstractMessageProducingEndpoint extends AbstractEndpoint { this.outputChannel = outputChannel; } + protected MessageChannel getOutputChannel() { + return this.outputChannel; + } + @Override protected void initialize() { Assert.notNull(this.outputChannel, "outputChannel is required"); diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/InboundChannelAdapter.java b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/InboundChannelAdapter.java index a851fa5b27..fa55259a5e 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/InboundChannelAdapter.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/InboundChannelAdapter.java @@ -30,12 +30,10 @@ import org.springframework.integration.scheduling.TaskScheduler; * * @author Mark Fisher */ -public class InboundChannelAdapter extends AbstractEndpoint implements Lifecycle { +public class InboundChannelAdapter extends AbstractMessageProducingEndpoint implements Lifecycle { private volatile PollableSource source; - private volatile MessageChannel channel; - private volatile Schedule schedule; private volatile SourcePoller poller; @@ -51,10 +49,6 @@ public class InboundChannelAdapter extends AbstractEndpoint implements Lifecycle this.source = source; } - public void setChannel(MessageChannel channel) { - this.channel = channel; - } - public void setSchedule(Schedule schedule) { this.schedule = schedule; } @@ -75,7 +69,7 @@ public class InboundChannelAdapter extends AbstractEndpoint implements Lifecycle if (this.running) { return; } - this.poller = new SourcePoller(source, channel, schedule); + this.poller = new SourcePoller(source, this.getOutputChannel(), schedule); if (maxMessagesPerPoll < 0 && source instanceof MethodInvokingSource) { // the default is 1 since a MethodInvokingSource might return a non-null value // every time it is invoked, thus producing an infinite number of messages per poll diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/bus/DefaultMessageBusTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/bus/DefaultMessageBusTests.java index e28f37d825..eb6cc98c0b 100644 --- a/org.springframework.integration/src/test/java/org/springframework/integration/bus/DefaultMessageBusTests.java +++ b/org.springframework.integration/src/test/java/org/springframework/integration/bus/DefaultMessageBusTests.java @@ -197,7 +197,7 @@ public class DefaultMessageBusTests { InboundChannelAdapter channelAdapter = new InboundChannelAdapter(); channelAdapter.setSource(new FailingSource(latch)); channelAdapter.setSchedule(new PollingSchedule(1000)); - channelAdapter.setChannel(outputChannel); + channelAdapter.setOutputChannel(outputChannel); channelAdapter.setBeanName("testChannel"); bus.registerEndpoint(channelAdapter); bus.start();