INT-702 added support for 'order' on 'outbound-channel-adapter'
This commit is contained in:
@@ -46,6 +46,7 @@ public abstract class AbstractOutboundChannelAdapterParser extends AbstractChann
|
||||
IntegrationNamespaceUtils.configurePollerMetadata(pollerElement, builder, parserContext);
|
||||
}
|
||||
builder.addPropertyValue("inputChannelName", channelName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup");
|
||||
return builder.getBeanDefinition();
|
||||
}
|
||||
|
||||
@@ -60,6 +61,10 @@ public abstract class AbstractOutboundChannelAdapterParser extends AbstractChann
|
||||
parserContext.getReaderContext().error(
|
||||
"Consumer parsing must return a BeanDefinition.", element);
|
||||
}
|
||||
String order = element.getAttribute("order");
|
||||
if (StringUtils.hasText(order)) {
|
||||
definition.getPropertyValues().addPropertyValue("order", order);
|
||||
}
|
||||
return BeanDefinitionReaderUtils.registerWithGeneratedName(
|
||||
definition, parserContext.getRegistry());
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -50,6 +50,10 @@ public class MethodInvokingOutboundChannelAdapterParser extends AbstractOutbound
|
||||
IntegrationNamespaceUtils.BASE_PACKAGE + ".handler.MethodInvokingMessageHandler");
|
||||
invokerBuilder.addConstructorArgReference(element.getAttribute("ref"));
|
||||
invokerBuilder.addConstructorArgValue(element.getAttribute("method"));
|
||||
String order = element.getAttribute("order");
|
||||
if (StringUtils.hasText(order)) {
|
||||
invokerBuilder.addPropertyValue("order", order);
|
||||
}
|
||||
return invokerBuilder.getBeanDefinition();
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.integration.handler;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessagingException;
|
||||
import org.springframework.integration.message.MessageHandler;
|
||||
@@ -28,7 +29,10 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class MethodInvokingMessageHandler extends MessageMappingMethodInvoker implements MessageHandler {
|
||||
public class MethodInvokingMessageHandler extends MessageMappingMethodInvoker implements MessageHandler, Ordered {
|
||||
|
||||
private volatile int order = Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
|
||||
public MethodInvokingMessageHandler(Object object, Method method) {
|
||||
super(object, method);
|
||||
@@ -41,6 +45,14 @@ public class MethodInvokingMessageHandler extends MessageMappingMethodInvoker im
|
||||
}
|
||||
|
||||
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
public void handleMessage(Message<?> message) {
|
||||
Object result = this.invokeMethod(message);
|
||||
if (result != null) {
|
||||
|
||||
@@ -26,13 +26,9 @@
|
||||
<xsd:complexType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Defines the ApplicationEventMulticaster to use
|
||||
for this
|
||||
ApplicationContext. The "task-executor" reference is
|
||||
optional.
|
||||
If not provided, an instance of ThreadPoolTaskExecutor
|
||||
will be
|
||||
created by default.
|
||||
Defines the ApplicationEventMulticaster to use for this ApplicationContext.
|
||||
The "task-executor" reference is optional. If not provided, an instance of
|
||||
ThreadPoolTaskExecutor will be created by default.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="task-executor" type="xsd:string">
|
||||
@@ -273,14 +269,27 @@
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="outbound-channel-adapter" type="methodInvokingChannelAdapterType">
|
||||
<xsd:element name="outbound-channel-adapter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Defines a Channel Adapter that receives from a
|
||||
MessageChannel and sends to
|
||||
a MessageConsumer.
|
||||
Defines a Channel Adapter that receives from a MessageChannel and sends to
|
||||
a method-invoking MessageHandler.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="methodInvokingChannelAdapterType">
|
||||
<xsd:attribute name="order">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Specifies the order for invocation when this endpoint is connected as a
|
||||
subscriber to a SubscribableChannel.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="logging-channel-adapter">
|
||||
|
||||
Reference in New Issue
Block a user