INT-3246: MessageHandlingException Refactoring
JIRA: https://jira.springsource.org/browse/INT-3246 INT-3246: Add description to usage of MHException Deprecate `MessageRejectedException` constructor INT-3246: Remove `MessageHandlingException` class
This commit is contained in:
committed by
Gary Russell
parent
0be6ade8f8
commit
acf2ad2229
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
|
||||
/**
|
||||
* Exception that indicates an error occurred during message handling.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MessageHandlingException extends MessagingException {
|
||||
|
||||
public MessageHandlingException(Message<?> failedMessage) {
|
||||
super(failedMessage);
|
||||
}
|
||||
|
||||
public MessageHandlingException(Message<?> failedMessage, String description) {
|
||||
super(failedMessage, description);
|
||||
}
|
||||
|
||||
public MessageHandlingException(Message<?> failedMessage, Throwable cause) {
|
||||
super(failedMessage, cause);
|
||||
}
|
||||
|
||||
public MessageHandlingException(Message<?> failedMessage, String description, Throwable cause) {
|
||||
super(failedMessage, description, cause);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.integration;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
|
||||
/**
|
||||
* Exception that indicates a message has been rejected by a selector.
|
||||
@@ -26,8 +27,12 @@ import org.springframework.messaging.Message;
|
||||
@SuppressWarnings("serial")
|
||||
public class MessageRejectedException extends MessageHandlingException {
|
||||
|
||||
/**
|
||||
* @deprecated since 4.0 in favor of {@code MessageRejectedException(Message, String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public MessageRejectedException(Message<?> failedMessage) {
|
||||
super(failedMessage);
|
||||
super(failedMessage, null);
|
||||
}
|
||||
|
||||
public MessageRejectedException(Message<?> failedMessage, String description) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -26,7 +26,7 @@ import org.aopalliance.aop.Advice;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.core.task.SyncTaskExecutor;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.channel.MessagePublishingErrorHandler;
|
||||
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
|
||||
import org.springframework.integration.transaction.ExpressionEvaluatingTransactionSynchronizationProcessor;
|
||||
@@ -281,7 +281,8 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
|
||||
throw (RuntimeException) e;
|
||||
}
|
||||
else {
|
||||
throw new MessageHandlingException(new ErrorMessage(e));
|
||||
throw new MessageHandlingException(new ErrorMessage(e),
|
||||
AbstractPollingEndpoint.this.getComponentName() + " failed to invoke pollingTask.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.integration.handler;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.context.Orderable;
|
||||
@@ -32,7 +32,7 @@ import org.springframework.util.Assert;
|
||||
* and error handling capabilities. Asserts that the incoming Message is not
|
||||
* null and that it does not contain a null payload. Converts checked exceptions
|
||||
* into runtime {@link MessagingException}s.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.SpelParserConfiguration;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.store.MessageGroup;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.core.MessageProducer;
|
||||
import org.springframework.integration.filter.MessageFilter;
|
||||
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -22,7 +22,7 @@ import java.lang.reflect.Method;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.util.MessagingMethodInvokerHelper;
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,10 @@ import org.springframework.integration.util.MessagingMethodInvokerHelper;
|
||||
* the method-selection will be dynamic, based on the underlying SpEL method resolution. Alternatively, an annotation
|
||||
* type may be provided so that the candidates for SpEL's method resolution are determined by the presence of that
|
||||
* annotation rather than the method name.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MethodInvokingMessageProcessor<T> extends AbstractMessageProcessor<T> {
|
||||
@@ -55,13 +56,13 @@ public class MethodInvokingMessageProcessor<T> extends AbstractMessageProcessor<
|
||||
public MethodInvokingMessageProcessor(Object targetObject, Class<? extends Annotation> annotationType) {
|
||||
delegate = new MessagingMethodInvokerHelper<T>(targetObject, annotationType, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setConversionService(ConversionService conversionService) {
|
||||
super.setConversionService(conversionService);
|
||||
delegate.setConversionService(conversionService);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
super.setBeanFactory(beanFactory);
|
||||
@@ -73,7 +74,7 @@ public class MethodInvokingMessageProcessor<T> extends AbstractMessageProcessor<
|
||||
return delegate.process(message);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new MessageHandlingException(message, e);
|
||||
throw new MessageHandlingException(message, this.delegate + " failed to process Message.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.integration.handler;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.expression.IntegrationEvaluationContextAware;
|
||||
import org.springframework.integration.gateway.MessagingGatewaySupport;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.TypeConverter;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.annotation.Header;
|
||||
import org.springframework.integration.annotation.Headers;
|
||||
import org.springframework.integration.annotation.Payload;
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.store.MessageGroup;
|
||||
import org.springframework.integration.store.SimpleMessageStore;
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.store.MessageGroup;
|
||||
import org.springframework.integration.store.MessageGroupStore;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.internal.stubbing.answers.ThrowsException;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.store.MessageGroup;
|
||||
import org.springframework.integration.store.MessageGroupStore;
|
||||
import org.springframework.integration.store.SimpleMessageGroup;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -88,7 +88,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
Mockito.reset(handlerA);
|
||||
Mockito.reset(handlerB);
|
||||
Mockito.reset(handlerC);
|
||||
|
||||
|
||||
ac = new ClassPathXmlApplicationContext("MixedDispatcherConfigurationScenarioTests-context.xml",
|
||||
MixedDispatcherConfigurationScenarioTests.class);
|
||||
executor = ac.getBean("taskExecutor", ExecutorService.class);
|
||||
@@ -100,7 +100,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
@Test
|
||||
public void noFailoverNoLoadBalancing() {
|
||||
DirectChannel channel = (DirectChannel) ac.getBean("noLoadBalancerNoFailover");
|
||||
doThrow(new MessageRejectedException(message)).when(handlerA).handleMessage(message);
|
||||
doThrow(new MessageRejectedException(message, null)).when(handlerA).handleMessage(message);
|
||||
UnicastingDispatcher dispatcher = channel.getDispatcher();
|
||||
dispatcher.addHandler(handlerA);
|
||||
dispatcher.addHandler(handlerB);
|
||||
@@ -119,7 +119,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
@Test(timeout = 5000)
|
||||
public void noFailoverNoLoadBalancingConcurrent() throws Exception {
|
||||
final DirectChannel channel = (DirectChannel) ac.getBean("noLoadBalancerNoFailover");
|
||||
doThrow(new MessageRejectedException(message)).when(handlerA).handleMessage(message);
|
||||
doThrow(new MessageRejectedException(message, null)).when(handlerA).handleMessage(message);
|
||||
UnicastingDispatcher dispatcher = channel.getDispatcher();
|
||||
dispatcher.addHandler(handlerA);
|
||||
dispatcher.addHandler(handlerB);
|
||||
@@ -148,10 +148,10 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
}
|
||||
start.countDown();
|
||||
allDone.await();
|
||||
|
||||
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(5, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
assertTrue("not all messages were accepted", failed.get());
|
||||
verify(handlerA, times(TOTAL_EXECUTIONS)).handleMessage(message);
|
||||
verify(handlerB, times(0)).handleMessage(message);
|
||||
@@ -167,7 +167,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
dispatcher.addHandler(handlerB);
|
||||
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
RuntimeException e = new RuntimeException();
|
||||
allDone.countDown();
|
||||
failed.set(true);
|
||||
@@ -175,14 +175,14 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
throw e;
|
||||
}
|
||||
}).when(handlerA).handleMessage(message);
|
||||
|
||||
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
allDone.countDown();
|
||||
return null;
|
||||
}
|
||||
}).when(handlerB).handleMessage(message);
|
||||
|
||||
|
||||
Runnable messageSenderTask = new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
@@ -201,7 +201,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(5, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
assertTrue("not all messages were accepted", failed.get());
|
||||
verify(handlerA, times(TOTAL_EXECUTIONS)).handleMessage(message);
|
||||
verify(handlerB, times(0)).handleMessage(message);
|
||||
@@ -211,7 +211,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
@Test
|
||||
public void noFailoverLoadBalancing() {
|
||||
DirectChannel channel = (DirectChannel) ac.getBean("loadBalancerNoFailover");
|
||||
doThrow(new MessageRejectedException(message)).when(handlerA).handleMessage(message);
|
||||
doThrow(new MessageRejectedException(message, null)).when(handlerA).handleMessage(message);
|
||||
UnicastingDispatcher dispatcher = channel.getDispatcher();
|
||||
dispatcher.setLoadBalancingStrategy(new RoundRobinLoadBalancingStrategy());
|
||||
dispatcher.addHandler(handlerA);
|
||||
@@ -242,7 +242,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
@Test(timeout = 5000)
|
||||
public void noFailoverLoadBalancingConcurrent() throws Exception {
|
||||
final DirectChannel channel = (DirectChannel) ac.getBean("loadBalancerNoFailover");
|
||||
doThrow(new MessageRejectedException(message)).when(handlerA).handleMessage(message);
|
||||
doThrow(new MessageRejectedException(message, null)).when(handlerA).handleMessage(message);
|
||||
UnicastingDispatcher dispatcher = channel.getDispatcher();
|
||||
dispatcher.addHandler(handlerA);
|
||||
dispatcher.addHandler(handlerB);
|
||||
@@ -276,10 +276,10 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
}
|
||||
start.countDown();
|
||||
allDone.await();
|
||||
|
||||
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(5, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
assertTrue("not all messages were accepted", failed.get());
|
||||
verify(handlerA, times(14)).handleMessage(message);
|
||||
verify(handlerB, times(13)).handleMessage(message);
|
||||
@@ -300,7 +300,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
final Message<?> message = this.message;
|
||||
final AtomicBoolean failed = new AtomicBoolean(false);
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
failed.set(true);
|
||||
RuntimeException e = new RuntimeException();
|
||||
exceptionRegistry.add(e);
|
||||
@@ -339,7 +339,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(5, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
assertTrue("not all messages were accepted", failed.get());
|
||||
verify(handlerA, times(14)).handleMessage(message);
|
||||
verify(handlerB, times(13)).handleMessage(message);
|
||||
@@ -351,7 +351,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
public void failoverNoLoadBalancing() {
|
||||
DirectChannel channel = (DirectChannel) ac
|
||||
.getBean("noLoadBalancerFailover");
|
||||
doThrow(new MessageRejectedException(message)).when(handlerA)
|
||||
doThrow(new MessageRejectedException(message, null)).when(handlerA)
|
||||
.handleMessage(message);
|
||||
UnicastingDispatcher dispatcher = channel.getDispatcher();
|
||||
dispatcher.addHandler(handlerA);
|
||||
@@ -381,7 +381,7 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
throws Exception {
|
||||
final DirectChannel channel = (DirectChannel) ac
|
||||
.getBean("noLoadBalancerFailover");
|
||||
doThrow(new MessageRejectedException(message)).when(handlerA).handleMessage(message);
|
||||
doThrow(new MessageRejectedException(message, null)).when(handlerA).handleMessage(message);
|
||||
UnicastingDispatcher dispatcher = channel.getDispatcher();
|
||||
dispatcher.addHandler(handlerA);
|
||||
dispatcher.addHandler(handlerB);
|
||||
@@ -415,44 +415,44 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
}
|
||||
start.countDown();
|
||||
allDone.await();
|
||||
|
||||
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(5, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
assertFalse("not all messages were accepted", failed.get());
|
||||
verify(handlerA, times(TOTAL_EXECUTIONS)).handleMessage(message);
|
||||
verify(handlerB, times(TOTAL_EXECUTIONS)).handleMessage(message);
|
||||
verify(handlerC, never()).handleMessage(message);
|
||||
verify(exceptionRegistry, never()).add((Exception) anyObject());
|
||||
}
|
||||
|
||||
@Test(timeout = 5000)
|
||||
|
||||
@Test(timeout = 5000)
|
||||
public void failoverNoLoadBalancingWithExecutorConcurrent() throws Exception {
|
||||
final ExecutorChannel channel = (ExecutorChannel) ac.getBean("noLoadBalancerFailoverExecutor");
|
||||
final UnicastingDispatcher dispatcher = channel.getDispatcher();
|
||||
final UnicastingDispatcher dispatcher = channel.getDispatcher();
|
||||
dispatcher.addHandler(handlerA);
|
||||
dispatcher.addHandler(handlerB);
|
||||
dispatcher.addHandler(handlerB);
|
||||
dispatcher.addHandler(handlerC);
|
||||
|
||||
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
RuntimeException e = new RuntimeException();
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
RuntimeException e = new RuntimeException();
|
||||
failed.set(true);
|
||||
throw e;
|
||||
}
|
||||
}).when(handlerA).handleMessage(message);
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
allDone.countDown();
|
||||
return null;
|
||||
}
|
||||
}).when(handlerB).handleMessage(message);
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
return null;
|
||||
}
|
||||
}).when(handlerC).handleMessage(message);
|
||||
|
||||
|
||||
Runnable messageSenderTask = new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
@@ -465,14 +465,14 @@ public class MixedDispatcherConfigurationScenarioTests {
|
||||
};
|
||||
for (int i = 0; i < TOTAL_EXECUTIONS; i++) {
|
||||
executor.execute(messageSenderTask);
|
||||
|
||||
|
||||
}
|
||||
start.countDown();
|
||||
start.countDown();
|
||||
allDone.await();
|
||||
|
||||
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(5, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
verify(handlerA, times(TOTAL_EXECUTIONS)).handleMessage(message);
|
||||
verify(handlerB, times(TOTAL_EXECUTIONS)).handleMessage(message);
|
||||
verify(handlerC, never()).handleMessage(message);
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.MessageRejectedException;
|
||||
import org.springframework.integration.aggregator.AggregatingMessageHandler;
|
||||
import org.springframework.integration.aggregator.CorrelationStrategy;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.integration.config;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -200,7 +200,7 @@ public class SubscriberOrderTests {
|
||||
if (callNumber == methodNumber) {
|
||||
count++;
|
||||
if (count >= this.maxCallsPerMethod) {
|
||||
throw new MessageRejectedException(message);
|
||||
throw new MessageRejectedException(message, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.beans.TypeMismatchException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.endpoint.EventDrivenConsumer;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.expression.spel.SpelEvaluationException;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2002-2009 the original author or authors.
|
||||
/* Copyright 2002-2014 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.
|
||||
@@ -144,7 +144,7 @@ public class RoundRobinDispatcherConcurrentTests {
|
||||
public void noHandlerSkipUnderConcurrentFailureWithFailover() throws Exception {
|
||||
dispatcher.addHandler(handler1);
|
||||
dispatcher.addHandler(handler2);
|
||||
doThrow(new MessageRejectedException(message)).when(handler1).handleMessage(message);
|
||||
doThrow(new MessageRejectedException(message, null)).when(handler1).handleMessage(message);
|
||||
final CountDownLatch start = new CountDownLatch(1);
|
||||
final CountDownLatch allDone = new CountDownLatch(TOTAL_EXECUTIONS);
|
||||
final Message<?> message = this.message;
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
@@ -178,7 +178,7 @@ public class GatewayInvokingMessageHandlerTests {
|
||||
}
|
||||
|
||||
public String echoWithMessagingException(String value) {
|
||||
throw new MessageHandlingException(new GenericMessage<String>(value));
|
||||
throw new MessageHandlingException(new GenericMessage<String>(value), null);
|
||||
}
|
||||
|
||||
public String echoWithErrorAsync(String value) {
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.channel.MessagePublishingErrorHandler;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.integration.annotation.Header;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.expression.spel.SpelEvaluationException;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.annotation.Header;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.integration.gateway.GatewayProxyFactoryBean;
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.core.MessageSelector;
|
||||
import org.springframework.integration.endpoint.PollingConsumer;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.MessageRejectedException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.config.ConsumerEndpointFactoryBean;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.MessageRejectedException;
|
||||
import org.springframework.integration.channel.MessagePublishingErrorHandler;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.channel.NullChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Properties;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
import org.springframework.integration.annotation.Header;
|
||||
import org.springframework.integration.annotation.Transformer;
|
||||
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
|
||||
|
||||
Reference in New Issue
Block a user