From 20171072d63c718fc866ff938658717e54c269df Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Thu, 25 Jun 2009 21:38:44 +0000 Subject: [PATCH] INT-684 AbstractConsumerEndpointParser and AbstractMessageHandlerFactoryBean now support the 'order' attribute/property. --- .../config/AbstractMessageHandlerFactoryBean.java | 15 ++++++++++++--- .../xml/AbstractConsumerEndpointParser.java | 7 +++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/AbstractMessageHandlerFactoryBean.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/AbstractMessageHandlerFactoryBean.java index 247be535ce..59b635f0b8 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/AbstractMessageHandlerFactoryBean.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/AbstractMessageHandlerFactoryBean.java @@ -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); } } diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractConsumerEndpointParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractConsumerEndpointParser.java index b8b8d6a354..4318ffef3e 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractConsumerEndpointParser.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/AbstractConsumerEndpointParser.java @@ -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 childElements = DomUtils.getChildElementsByTagName(element, "bean");