Removed 'getErrorChannel' method from MessageBus.
This commit is contained in:
@@ -35,6 +35,7 @@ import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.integration.channel.ChannelRegistry;
|
||||
import org.springframework.integration.channel.ChannelRegistryAware;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.MessagePublishingErrorHandler;
|
||||
@@ -118,10 +119,6 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A
|
||||
}
|
||||
}
|
||||
|
||||
public MessageChannel getErrorChannel() {
|
||||
return this.lookupChannel(ERROR_CHANNEL_NAME);
|
||||
}
|
||||
|
||||
public MessageChannel lookupChannel(String channelName) {
|
||||
Assert.notNull(this.applicationContext, "ApplicationContext must not be null");
|
||||
if (this.applicationContext.containsBean(channelName)) {
|
||||
@@ -239,7 +236,8 @@ public class DefaultMessageBus implements MessageBus, ApplicationContextAware, A
|
||||
gateway.start();
|
||||
}
|
||||
if (this.taskScheduler instanceof SimpleTaskScheduler) {
|
||||
((SimpleTaskScheduler) this.taskScheduler).setErrorHandler(new MessagePublishingErrorHandler(this.getErrorChannel()));
|
||||
((SimpleTaskScheduler) this.taskScheduler).setErrorHandler(
|
||||
new MessagePublishingErrorHandler(this.lookupChannel(ChannelRegistry.ERROR_CHANNEL_NAME)));
|
||||
}
|
||||
this.taskScheduler.start();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.integration.bus;
|
||||
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.integration.channel.ChannelRegistry;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.endpoint.MessageEndpoint;
|
||||
|
||||
/**
|
||||
@@ -28,8 +27,6 @@ import org.springframework.integration.endpoint.MessageEndpoint;
|
||||
*/
|
||||
public interface MessageBus extends ChannelRegistry, Lifecycle {
|
||||
|
||||
MessageChannel getErrorChannel();
|
||||
|
||||
void registerEndpoint(MessageEndpoint endpoint);
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ import org.springframework.integration.bus.MessageBusInterceptorTests;
|
||||
import org.springframework.integration.bus.TestMessageBusAwareImpl;
|
||||
import org.springframework.integration.bus.TestMessageBusStartInterceptor;
|
||||
import org.springframework.integration.bus.TestMessageBusStopInterceptor;
|
||||
import org.springframework.integration.channel.ChannelRegistry;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.config.xml.MessageBusParser;
|
||||
import org.springframework.integration.scheduling.TaskScheduler;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
@@ -52,7 +54,8 @@ public class MessageBusParserTests {
|
||||
"messageBusWithErrorChannel.xml", this.getClass());
|
||||
DefaultMessageBus bus = (DefaultMessageBus) context.getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME);
|
||||
bus.initialize();
|
||||
assertEquals(context.getBean("errorChannel"), bus.getErrorChannel());
|
||||
MessageChannel channel = bus.lookupChannel(ChannelRegistry.ERROR_CHANNEL_NAME);
|
||||
assertEquals(context.getBean("errorChannel"), channel);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -61,7 +64,8 @@ public class MessageBusParserTests {
|
||||
"messageBusWithDefaults.xml", this.getClass());
|
||||
DefaultMessageBus bus = (DefaultMessageBus) context.getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME);
|
||||
bus.initialize();
|
||||
assertNotNull("parser should have created a default error channel", bus.getErrorChannel());
|
||||
assertNotNull("parser should have created a default error channel",
|
||||
bus.lookupChannel(ChannelRegistry.ERROR_CHANNEL_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user