INT-684 AbstractConsumerEndpointParser and AbstractMessageHandlerFactoryBean now support the 'order' attribute/property.

This commit is contained in:
Mark Fisher
2009-06-25 21:38:44 +00:00
parent 91ffae8a33
commit 20171072d6
2 changed files with 15 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,6 +41,8 @@ public abstract class AbstractMessageHandlerFactoryBean implements FactoryBean,
private volatile MessageChannel outputChannel;
private volatile Integer order;
private volatile boolean initialized;
private final Object initializationMonitor = new Object();
@@ -59,7 +61,11 @@ public abstract class AbstractMessageHandlerFactoryBean implements FactoryBean,
public void setOutputChannel(MessageChannel outputChannel) {
this.outputChannel = outputChannel;
}
public void setOrder(Integer order) {
this.order = order;
}
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}
@@ -70,9 +76,12 @@ public abstract class AbstractMessageHandlerFactoryBean implements FactoryBean,
Assert.notNull(this.handler, "failed to create MessageHandler");
if (this.handler instanceof AbstractReplyProducingMessageHandler) {
AbstractReplyProducingMessageHandler abstractHandler = (AbstractReplyProducingMessageHandler) this.handler;
if(this.outputChannel != null){
if (this.outputChannel != null) {
abstractHandler.setOutputChannel(this.outputChannel);
}
if (this.order != null) {
abstractHandler.setOrder(this.order.intValue());
}
abstractHandler.setBeanFactory(beanFactory);
}
}

View File

@@ -69,6 +69,7 @@ public abstract class AbstractConsumerEndpointParser extends AbstractBeanDefinit
protected final AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
BeanDefinitionBuilder handlerBuilder = this.parseHandler(element, parserContext);
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(handlerBuilder, element, "output-channel");
IntegrationNamespaceUtils.setValueIfAttributeDefined(handlerBuilder, element, "order");
AbstractBeanDefinition handlerBeanDefinition = handlerBuilder.getBeanDefinition();
String inputChannelAttributeName = this.getInputChannelAttributeName();
if (!element.hasAttribute(inputChannelAttributeName)) {
@@ -108,10 +109,8 @@ public abstract class AbstractConsumerEndpointParser extends AbstractBeanDefinit
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup");
return builder.getBeanDefinition();
}
/**
*
* @return
*/
@SuppressWarnings("unchecked")
protected BeanDefinition parseInnerHandlerDefinition(Element element, ParserContext parserContext){
// parses out inner bean definition for concrete implementation if defined
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "bean");