JmsOutboundGateway now throws a MessageTimeoutException in case a JMS reply Message is not received within the alloted timeout. The null object is no longer passed to the MessageConverter where a misleading Exception ("payload must not be null") was being thrown (INT-479).

This commit is contained in:
Mark Fisher
2008-11-17 17:07:11 +00:00
parent 304afa1e38
commit 6a4a246e31
3 changed files with 53 additions and 9 deletions

View File

@@ -55,6 +55,8 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
private volatile TaskExecutor taskExecutor;
private volatile ErrorHandler errorHandler;
private volatile PlatformTransactionManager transactionManager;
private volatile TransactionDefinition transactionDefinition;
@@ -70,8 +72,6 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
private volatile Runnable poller;
private volatile boolean initialized;
private volatile ErrorHandler errorHandler;
private final Object initializationMonitor = new Object();
@@ -96,7 +96,7 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
public void setTaskExecutor(TaskExecutor taskExecutor) {
this.taskExecutor = taskExecutor;
}
public void setErrorHandler(ErrorHandler errorHandler){
this.errorHandler = errorHandler;
}
@@ -148,13 +148,11 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
this.transactionManager, this.transactionDefinition);
}
this.poller = this.createPoller();
if(this.taskExecutor != null){
if(this.errorHandler == null){
taskExecutor = new ErrorHandlingTaskExecutor(
new MessagePublishingErrorHandler(new BeanFactoryChannelResolver(getBeanFactory())),taskExecutor);
} else {
taskExecutor = new ErrorHandlingTaskExecutor(errorHandler, taskExecutor);
if (this.taskExecutor != null) {
if (this.errorHandler == null) {
this.errorHandler = new MessagePublishingErrorHandler(new BeanFactoryChannelResolver(getBeanFactory()));
}
this.taskExecutor = new ErrorHandlingTaskExecutor(this.errorHandler, this.taskExecutor);
}
this.initialized = true;
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2002-2008 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.message;
import org.springframework.integration.core.Message;
/**
* @author Mark Fisher
*/
public class MessageTimeoutException extends MessageHandlingException {
public MessageTimeoutException(Message<?> failedMessage, String description, Throwable cause) {
super(failedMessage, description, cause);
}
public MessageTimeoutException(Message<?> failedMessage, String description) {
super(failedMessage, description);
}
public MessageTimeoutException(Message<?> failedMessage, Throwable cause) {
super(failedMessage, cause);
}
public MessageTimeoutException(Message<?> failedMessage) {
super(failedMessage);
}
}