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

@@ -35,6 +35,7 @@ import org.springframework.integration.handler.AbstractReplyProducingMessageHand
import org.springframework.integration.handler.ReplyMessageHolder;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.MessageHandlingException;
import org.springframework.integration.message.MessageTimeoutException;
import org.springframework.jms.connection.ConnectionFactoryUtils;
import org.springframework.jms.support.JmsUtils;
import org.springframework.jms.support.converter.MessageConverter;
@@ -199,6 +200,9 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
final Message<?> requestMessage = MessageBuilder.fromMessage(message).build();
try {
javax.jms.Message jmsReply = JmsOutboundGateway.this.sendAndReceive(requestMessage);
if (jmsReply == null) {
throw new MessageTimeoutException(message, "failed to receive JMS response within timeout of: " + this.receiveTimeout + "ms");
}
Object result = this.messageConverter.fromMessage(jmsReply);
replyMessageHolder.set(result);
}