INT-1076 The <payload-type-router/> element no longer accepts an 'ignore-channel-name-resolution-failures' attribute.

This commit is contained in:
Mark Fisher
2010-05-04 15:28:11 +00:00
parent 85c3263e1e
commit 447355be03
4 changed files with 61 additions and 36 deletions

View File

@@ -35,9 +35,9 @@ public abstract class AbstractRouterParser extends AbstractConsumerEndpointParse
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "default-output-channel");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "timeout");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "resolution-required");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-channel-name-resolution-failures");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "apply-sequence");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-send-failures");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-channel-name-resolution-failures");
this.parseRouter(element, builder, parserContext);
return builder;
}

View File

@@ -47,18 +47,32 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract
private volatile boolean ignoreChannelNameResolutionFailures;
/**
* Specify the {@link ChannelResolver} strategy to use.
* The default is a BeanFactoryChannelResolver.
*/
public void setChannelResolver(ChannelResolver channelResolver) {
super.setChannelResolver(channelResolver);
}
/**
* Specify a prefix to be added to each channel name prior to resolution.
*/
public void setPrefix(String prefix) {
this.prefix = prefix;
}
/**
* Specify a suffix to be added to each channel name prior to resolution.
*/
public void setSuffix(String suffix) {
this.suffix = suffix;
}
/**
* Specify whether this router should ignore any failure to resolve a channel name to
* an actual MessageChannel instance when delegating to the ChannelResolver strategy.
*/
public void setIgnoreChannelNameResolutionFailures(boolean ignoreChannelNameResolutionFailures) {
this.ignoreChannelNameResolutionFailures = ignoreChannelNameResolutionFailures;
}
@@ -69,7 +83,7 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract
"either a ChannelResolver or BeanFactory is required");
}
protected MessageChannel resolveChannelForName(String channelName, Message<?> message) {
private MessageChannel resolveChannelForName(String channelName, Message<?> message) {
Assert.state(this.getChannelResolver() != null,
"unable to resolve channel names, no ChannelResolver available");
@@ -98,8 +112,8 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract
return channels;
}
protected void addToCollection(Collection<MessageChannel> channels, Collection<?> channelIndicators, Message<?> message) {
@SuppressWarnings("unchecked")
private void addToCollection(Collection<MessageChannel> channels, Collection<?> channelIndicators, Message<?> message) {
if (channelIndicators == null) {
return;
}
@@ -135,7 +149,7 @@ public abstract class AbstractChannelNameResolvingMessageRouter extends Abstract
}
}
protected void addChannelFromString(Collection<MessageChannel> channels, String channelName, Message<?> message) {
private void addChannelFromString(Collection<MessageChannel> channels, String channelName, Message<?> message) {
if (channelName.indexOf(',') != -1) {
for (String name : StringUtils.commaDelimitedListToStringArray(channelName)) {
addChannelFromString(channels, name, message);

View File

@@ -1383,7 +1383,7 @@
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="channelResolvingRouterType">
<xsd:extension base="channelNameResolvingRouterType">
<xsd:sequence>
<xsd:element name="mapping" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
@@ -1438,8 +1438,6 @@
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="ignore-send-failures" type="xsd:string" />
<xsd:attribute name="apply-sequence" type="xsd:string" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -1486,7 +1484,7 @@
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="channelResolvingRouterType">
<xsd:extension base="channelNameResolvingRouterType">
<xsd:all>
<xsd:element name="poller" type="innerPollerType" minOccurs="0" maxOccurs="1" />
<xsd:element ref="beans:bean" minOccurs="0" maxOccurs="1" />
@@ -1530,6 +1528,20 @@
</xsd:complexType>
</xsd:element>
<xsd:complexType name="channelNameResolvingRouterType">
<xsd:complexContent>
<xsd:extension base="channelResolvingRouterType">
<xsd:attribute name="ignore-channel-name-resolution-failures" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Specify whether a failure to resolve a channel name returned by this router should be ignored.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="channelResolvingRouterType">
<xsd:complexContent>
<xsd:extension base="baseRouterType">
@@ -1540,6 +1552,12 @@
<tool:expected-type
type="org.springframework.integration.core.MessageChannel" />
</tool:annotation>
<xsd:documentation>
Reference to the default channel where Messages should be sent if channel
resolution fails to return any channels. If no default channel is
provided, the router will either drop the Message or throw an Exception
depending on the value of the "resolution-required" attribute.
</xsd:documentation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
@@ -1550,28 +1568,6 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="ignore-channel-name-resolution-failures" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Specify whether a failure to resolve a channel name returned by this router should be ignored.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="ignore-send-failures" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Specify whether a failure to send to a single channel should be ignored.
Otherwise MessageDeliveryExceptions will be thrown.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="apply-sequence" type="xsd:string" >
<xsd:annotation>
<xsd:documentation>
Specify whether sequence number and size headers should be added to each Message.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -1587,6 +1583,21 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="ignore-send-failures" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Specify whether a failure to send to a single channel should be ignored.
Otherwise MessageDeliveryExceptions will be thrown.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="apply-sequence" type="xsd:string" >
<xsd:annotation>
<xsd:documentation>
Specify whether sequence number and size headers should be added to each Message.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 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.
@@ -84,9 +84,9 @@ public class PayloadTypeRouterParserTests {
"<beans:beans xmlns=\"http://www.springframework.org/schema/integration\"" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:beans=\"http://www.springframework.org/schema/beans\"" +
" xsi:schemaLocation=\"http://www.springframework.org/schema/beans" +
" http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" +
" http://www.springframework.org/schema/beans/spring-beans.xsd" +
" http://www.springframework.org/schema/integration" +
" http://www.springframework.org/schema/integration/spring-integration-1.0.xsd\">" +
" http://www.springframework.org/schema/integration/spring-integration.xsd\">" +
" <channel id=\"routingChannel\" />" +
" <payload-type-router input-channel=\"routingChannel\">" +
" <mapping type=\"FAKE_TYPE\" channel=\"channel1\" />" +
@@ -98,9 +98,9 @@ public class PayloadTypeRouterParserTests {
"<beans:beans xmlns=\"http://www.springframework.org/schema/integration\"" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:beans=\"http://www.springframework.org/schema/beans\"" +
" xsi:schemaLocation=\"http://www.springframework.org/schema/beans" +
" http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" +
" http://www.springframework.org/schema/beans/spring-beans.xsd" +
" http://www.springframework.org/schema/integration" +
" http://www.springframework.org/schema/integration/spring-integration-1.0.xsd\">" +
" http://www.springframework.org/schema/integration/spring-integration.xsd\">" +
" <channel id=\"routingChannel\" />" +
" <payload-type-router input-channel=\"routingChannel\"/>" +
"</beans:beans>";