diff --git a/spring-integration-core/src/main/java/org/springframework/integration/bus/MessageBus.java b/spring-integration-core/src/main/java/org/springframework/integration/bus/MessageBus.java index 4c8c96f0d0..edd6691adf 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/bus/MessageBus.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/bus/MessageBus.java @@ -146,8 +146,8 @@ public class MessageBus implements ChannelRegistry, ApplicationContextAware, Lif } public void initialize() { - if (this.getInvalidMessageChannel() == null) { - this.setInvalidMessageChannel(new SimpleChannel(Integer.MAX_VALUE)); + if (this.getErrorChannel() == null) { + this.setErrorChannel(new SimpleChannel(Integer.MAX_VALUE)); } if (this.taskScheduler == null) { this.setMessagingTaskScheduler(createDefaultScheduler()); @@ -162,17 +162,17 @@ public class MessageBus implements ChannelRegistry, ApplicationContextAware, Lif SimpleMessagingTaskScheduler scheduler = new SimpleMessagingTaskScheduler(); scheduler.setCorePoolSize(this.dispatcherPoolSize); scheduler.setThreadFactory(threadFactory); - scheduler.setErrorHandler(new MessagePublishingErrorHandler(this.getInvalidMessageChannel())); + scheduler.setErrorHandler(new MessagePublishingErrorHandler(this.getErrorChannel())); scheduler.afterPropertiesSet(); return scheduler; } - public MessageChannel getInvalidMessageChannel() { - return this.channelRegistry.getInvalidMessageChannel(); + public MessageChannel getErrorChannel() { + return this.channelRegistry.getErrorChannel(); } - public void setInvalidMessageChannel(MessageChannel invalidMessageChannel) { - this.channelRegistry.setInvalidMessageChannel(invalidMessageChannel); + public void setErrorChannel(MessageChannel errorChannel) { + this.channelRegistry.setErrorChannel(errorChannel); } public MessageChannel lookupChannel(String channelName) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelRegistry.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelRegistry.java index 0217c5a98a..307bc4f532 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelRegistry.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelRegistry.java @@ -27,8 +27,8 @@ public interface ChannelRegistry { MessageChannel lookupChannel(String channelName); - void setInvalidMessageChannel(MessageChannel invalidMessageChannel); + void setErrorChannel(MessageChannel errorChannel); - MessageChannel getInvalidMessageChannel(); + MessageChannel getErrorChannel(); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/DefaultChannelRegistry.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/DefaultChannelRegistry.java index 232276b925..3274df97d0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/DefaultChannelRegistry.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/DefaultChannelRegistry.java @@ -30,15 +30,15 @@ public class DefaultChannelRegistry implements ChannelRegistry { private Map channels = new ConcurrentHashMap(); - private MessageChannel invalidMessageChannel; + private MessageChannel errorChannel; - public void setInvalidMessageChannel(MessageChannel invalidMessageChannel) { - this.invalidMessageChannel = invalidMessageChannel; + public void setErrorChannel(MessageChannel errorChannel) { + this.errorChannel = errorChannel; } - public MessageChannel getInvalidMessageChannel() { - return this.invalidMessageChannel; + public MessageChannel getErrorChannel() { + return this.errorChannel; } public MessageChannel lookupChannel(String channelName) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/MessageBusParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/MessageBusParser.java index c6643a8cb2..08ee4b895d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/MessageBusParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/MessageBusParser.java @@ -36,7 +36,7 @@ public class MessageBusParser extends AbstractSimpleBeanDefinitionParser { public static final String MESSAGE_BUS_BEAN_NAME = "org.springframework.integration.bus.internalMessageBus"; - private static final String INVALID_MESSAGE_CHANNEL_ATTRIBUTE = "invalid-message-channel"; + private static final String ERROR_CHANNEL_ATTRIBUTE = "error-channel"; @Override @@ -52,15 +52,15 @@ public class MessageBusParser extends AbstractSimpleBeanDefinitionParser { @Override protected boolean isEligibleAttribute(String attributeName) { - return !INVALID_MESSAGE_CHANNEL_ATTRIBUTE.equals(attributeName) && super.isEligibleAttribute(attributeName); + return !ERROR_CHANNEL_ATTRIBUTE.equals(attributeName) && super.isEligibleAttribute(attributeName); } @Override protected void postProcess(BeanDefinitionBuilder beanDefinition, Element element) { - String invalidMessageChannelRef = element.getAttribute(INVALID_MESSAGE_CHANNEL_ATTRIBUTE); - if (StringUtils.hasText(invalidMessageChannelRef)) { + String errorChannelRef = element.getAttribute(ERROR_CHANNEL_ATTRIBUTE); + if (StringUtils.hasText(errorChannelRef)) { beanDefinition.addPropertyReference(Conventions.attributeNameToPropertyName( - INVALID_MESSAGE_CHANNEL_ATTRIBUTE), invalidMessageChannelRef); + ERROR_CHANNEL_ATTRIBUTE), errorChannelRef); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/spring-integration-1.0.xsd b/spring-integration-core/src/main/java/org/springframework/integration/config/spring-integration-1.0.xsd index fc3aabc891..6bf2166e9e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/spring-integration-1.0.xsd +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/spring-integration-1.0.xsd @@ -25,7 +25,7 @@ - + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/bus/MessageBusTests.java b/spring-integration-core/src/test/java/org/springframework/integration/bus/MessageBusTests.java index 338efac7d1..5dc182fda6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/bus/MessageBusTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/bus/MessageBusTests.java @@ -159,7 +159,7 @@ public class MessageBusTests { } @Test - public void testInvalidMessageChannelWithFailedDispatch() throws InterruptedException { + public void testErrorChannelWithFailedDispatch() throws InterruptedException { MessageBus bus = new MessageBus(); CountDownLatch latch = new CountDownLatch(1); SourceAdapter sourceAdapter = new PollingSourceAdapter(new FailingSource(latch)); @@ -167,7 +167,7 @@ public class MessageBusTests { bus.registerSourceAdapter("testAdapter", sourceAdapter); bus.start(); latch.await(1000, TimeUnit.MILLISECONDS); - Message message = bus.getInvalidMessageChannel().receive(100); + Message message = bus.getErrorChannel().receive(100); assertNotNull("message should not be null", message); assertTrue(message instanceof ErrorMessage); assertEquals("intentional test failure", ((ErrorMessage) message).getPayload().getMessage()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/MessageBusParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/MessageBusParserTests.java index 4bc0423359..62b113d5a3 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/MessageBusParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/MessageBusParserTests.java @@ -39,7 +39,7 @@ public class MessageBusParserTests { "messageBusWithErrorChannelReference.xml", this.getClass()); MessageBus bus = (MessageBus) context.getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME); bus.initialize(); - assertEquals(context.getBean("errorMessages"), bus.getInvalidMessageChannel()); + assertEquals(context.getBean("testErrorChannel"), bus.getErrorChannel()); } @Test @@ -48,7 +48,7 @@ public class MessageBusParserTests { "messageBusWithDefaults.xml", this.getClass()); MessageBus bus = (MessageBus) context.getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME); bus.initialize(); - assertNotNull("bus should have created a default error channel", bus.getInvalidMessageChannel()); + assertNotNull("bus should have created a default error channel", bus.getErrorChannel()); } @Test(expected=MessagingConfigurationException.class) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/messageBusWithErrorChannelReference.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/messageBusWithErrorChannelReference.xml index 139800609b..59650f6f96 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/messageBusWithErrorChannelReference.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/messageBusWithErrorChannelReference.xml @@ -7,8 +7,8 @@ http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-1.0.xsd"> - + - +