Renamed InboundChannelAdapter to SourcePollingChannelAdapter since other event-driven inbound Channel Adapters may extend AbstractMessageProducingEndpoint directly.
This commit is contained in:
@@ -27,7 +27,7 @@ import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.ConfigurationException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.endpoint.InboundChannelAdapter;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.scheduling.PollingSchedule;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
@@ -60,7 +60,7 @@ public abstract class AbstractPollingInboundChannelAdapterParser extends Abstrac
|
||||
}
|
||||
String channelName = element.getAttribute("channel");
|
||||
Element pollerElement = DomUtils.getChildElementByTagName(element, "poller");
|
||||
BeanDefinitionBuilder adapterBuilder = BeanDefinitionBuilder.genericBeanDefinition(InboundChannelAdapter.class);
|
||||
BeanDefinitionBuilder adapterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SourcePollingChannelAdapter.class);
|
||||
adapterBuilder.addPropertyReference("source", source);
|
||||
if (StringUtils.hasText(channelName)) {
|
||||
adapterBuilder.addPropertyReference("channel", channelName);
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.ConfigurationException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.endpoint.InboundChannelAdapter;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.endpoint.OutboundChannelAdapter;
|
||||
import org.springframework.integration.handler.MethodInvokingTarget;
|
||||
import org.springframework.integration.message.MethodInvokingSource;
|
||||
@@ -72,7 +72,7 @@ public class ChannelAdapterParser extends AbstractBeanDefinitionParser {
|
||||
invokerBuilder.addPropertyValue("methodName", methodName);
|
||||
source = BeanDefinitionReaderUtils.registerWithGeneratedName(invokerBuilder.getBeanDefinition(), parserContext.getRegistry());
|
||||
}
|
||||
adapterBuilder = BeanDefinitionBuilder.genericBeanDefinition(InboundChannelAdapter.class);
|
||||
adapterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SourcePollingChannelAdapter.class);
|
||||
adapterBuilder.addPropertyReference("source", source);
|
||||
if (StringUtils.hasText(channelName)) {
|
||||
adapterBuilder.addPropertyReference("outputChannel", channelName);
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.integration.bus.MessageBus;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.endpoint.InboundChannelAdapter;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.endpoint.MessageEndpoint;
|
||||
import org.springframework.integration.endpoint.OutboundChannelAdapter;
|
||||
import org.springframework.integration.handler.MethodInvokingTarget;
|
||||
@@ -82,13 +82,13 @@ public class ChannelAdapterAnnotationPostProcessor implements MethodAnnotationPo
|
||||
return bean;
|
||||
}
|
||||
|
||||
private InboundChannelAdapter createInboundChannelAdapter(MethodInvokingSource source, MessageChannel channel, Poller pollerAnnotation) {
|
||||
private SourcePollingChannelAdapter createInboundChannelAdapter(MethodInvokingSource source, MessageChannel channel, Poller pollerAnnotation) {
|
||||
if (pollerAnnotation == null) {
|
||||
throw new ConfigurationException("The @Poller annotation is required (at method-level) "
|
||||
+ "when using the @ChannelAdapter annotation with a no-arg method.");
|
||||
}
|
||||
Schedule schedule = this.createSchedule(pollerAnnotation);
|
||||
InboundChannelAdapter adapter = new InboundChannelAdapter();
|
||||
SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter();
|
||||
adapter.setSource(source);
|
||||
adapter.setOutputChannel(channel);
|
||||
adapter.setSchedule(schedule);
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.integration.scheduling.TaskScheduler;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class InboundChannelAdapter extends AbstractMessageProducingEndpoint implements Lifecycle {
|
||||
public class SourcePollingChannelAdapter extends AbstractMessageProducingEndpoint implements Lifecycle {
|
||||
|
||||
private volatile PollableSource<?> source;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.channel.PublishSubscribeChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.endpoint.AbstractInOutEndpoint;
|
||||
import org.springframework.integration.endpoint.InboundChannelAdapter;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.message.ErrorMessage;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.integration.message.Message;
|
||||
@@ -194,7 +194,7 @@ public class DefaultMessageBusTests {
|
||||
errorChannel.setBeanName("errorChannel");
|
||||
bus.registerChannel(errorChannel);
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
InboundChannelAdapter channelAdapter = new InboundChannelAdapter();
|
||||
SourcePollingChannelAdapter channelAdapter = new SourcePollingChannelAdapter();
|
||||
channelAdapter.setSource(new FailingSource(latch));
|
||||
channelAdapter.setSchedule(new PollingSchedule(1000));
|
||||
channelAdapter.setOutputChannel(outputChannel);
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.integration.bus.MessageBus;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.endpoint.InboundChannelAdapter;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.endpoint.OutboundChannelAdapter;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
@@ -88,7 +88,7 @@ public class ChannelAdapterParserTests extends AbstractJUnit4SpringContextTests
|
||||
assertNull(bus.lookupChannel(beanName));
|
||||
Object adapter = bus.lookupEndpoint(beanName);
|
||||
assertNotNull(adapter);
|
||||
assertTrue(adapter instanceof InboundChannelAdapter);
|
||||
assertTrue(adapter instanceof SourcePollingChannelAdapter);
|
||||
TestBean testBean = (TestBean) this.applicationContext.getBean("testBean");
|
||||
testBean.store("source test");
|
||||
bus.start();
|
||||
|
||||
Reference in New Issue
Block a user