Removed the 'errorHandler' property from AbstractMessageConsumer and the 'error-handler' attribute from the schema. Will be adding configurable errorChannel Message header instead.

This commit is contained in:
Mark Fisher
2008-10-15 22:21:27 +00:00
parent e6af632f7d
commit a8694526ec
8 changed files with 14 additions and 84 deletions

View File

@@ -31,7 +31,6 @@ import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.MessageRejectedException;
import org.springframework.integration.message.StringMessage;
/**
* @author Mark Fisher
@@ -76,16 +75,4 @@ public class EndpointParserTests {
inputChannel.send(message);
}
@Test
public void testEndpointWithErrorHandler() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"endpointWithErrorHandler.xml", this.getClass());
MessageChannel channel = (MessageChannel) context.getBean("channel");
TestErrorHandler errorHandler = (TestErrorHandler) context.getBean("errorHandler");
assertNull(errorHandler.getLastError());
channel.send(new StringMessage("test"));
assertNotNull(errorHandler.getLastError());
assertEquals("intentional test failure", errorHandler.getLastError().getMessage());
}
}

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<message-bus/>
<channel id="channel"/>
<service-activator id="endpoint" input-channel="channel" ref="testBean" error-handler="errorHandler"/>
<beans:bean id="testBean" class="org.springframework.integration.config.ExceptionThrowingTestBean"/>
<beans:bean id="errorHandler" class="org.springframework.integration.config.TestErrorHandler"/>
</beans:beans>

View File

@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.ChannelResolutionException;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.core.Message;
import org.springframework.integration.core.MessageChannel;
@@ -98,17 +99,14 @@ public class ReturnAddressTests {
assertNull(channel2.receive(0));
}
@Test
@Test(expected = ChannelResolutionException.class)
public void returnAddressFallbackButNotAvailable() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"returnAddressTests.xml", this.getClass());
MessageChannel channel3 = (MessageChannel) context.getBean("channel3");
PollableChannel errorChannel = (PollableChannel) context.getBean("errorChannel");
context.start();
StringMessage message = new StringMessage("*");
channel3.send(message);
Message<?> errorMessage = errorChannel.receive(3000);
assertNotNull(errorMessage.getPayload());
}
@Test

View File

@@ -21,19 +21,12 @@
<si:channel id="replyChannel">
<si:queue capacity="5"/>
</si:channel>
<si:channel id="errorChannel">
<si:queue capacity="5"/>
</si:channel>
<si:service-activator input-channel="channel1" ref="testBean" method="duplicate" output-channel="channel2"/>
<si:service-activator input-channel="channel2" ref="testBean" method="duplicate" output-channel="channel3"/>
<si:service-activator input-channel="channel3" ref="testBean" method="duplicate" error-handler="errorHandler"/>
<si:service-activator input-channel="channel3" ref="testBean" method="duplicate"/>
<si:service-activator input-channel="channel4" ref="testBean" method="duplicate" output-channel="replyChannel"/>
<bean id="errorHandler" class="org.springframework.integration.channel.MessagePublishingErrorHandler">
<property name="errorChannel" ref="errorChannel"/>
</bean>
<bean id="testBean" class="org.springframework.integration.endpoint.TestBean"/>
</beans>