The 'channel' element now requires an 'id'.
This commit is contained in:
@@ -66,9 +66,6 @@ public class ChannelParser implements BeanDefinitionParser {
|
||||
}
|
||||
channelDef.getConstructorArgumentValues().addGenericArgumentValue(dispatcherPolicy);
|
||||
String beanName = element.getAttribute(ID_ATTRIBUTE);
|
||||
if (!StringUtils.hasText(beanName)) {
|
||||
beanName = parserContext.getReaderContext().generateBeanName(channelDef);
|
||||
}
|
||||
parserContext.registerBeanComponent(new BeanComponentDefinition(channelDef, beanName));
|
||||
return channelDef;
|
||||
}
|
||||
|
||||
@@ -47,15 +47,12 @@
|
||||
Defines a message channel.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="beans:identifiedType">
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="dispatcher-policy" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="capacity" type="xsd:integer"/>
|
||||
<xsd:attribute name="publish-subscribe" type="xsd:boolean" default="false"/>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="dispatcher-policy" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="id" type="xsd:ID" use="required"/>
|
||||
<xsd:attribute name="capacity" type="xsd:integer"/>
|
||||
<xsd:attribute name="publish-subscribe" type="xsd:boolean" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
@@ -53,9 +53,7 @@ public class MessagePublishingErrorHandler implements ErrorHandler {
|
||||
public void handle(Throwable t) {
|
||||
if (this.errorChannel != null) {
|
||||
try {
|
||||
if(this.errorChannel.send(new ErrorMessage(t), this.sendTimeout)) {
|
||||
return;
|
||||
}
|
||||
this.errorChannel.send(new ErrorMessage(t), this.sendTimeout);
|
||||
}
|
||||
catch (Throwable ignore) { // message will be logged only
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.dispatcher.DefaultMessageDispatcher;
|
||||
@@ -40,6 +41,11 @@ import org.springframework.integration.message.StringMessage;
|
||||
*/
|
||||
public class ChannelParserTests {
|
||||
|
||||
@Test(expected=FatalBeanException.class)
|
||||
public void testChannelWithoutId() {
|
||||
new ClassPathXmlApplicationContext("channelWithoutId.xml", this.getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelWithCapacity() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
|
||||
|
||||
<integration:channel/>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user