From b59bdc0d70087b015589a70ed3cb32ef44cf6dd6 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Fri, 29 Apr 2011 14:27:41 -0400 Subject: [PATCH] INT-1795 the default receiveTimeout for a JmsTemplate used by an 'inbound-channel-adapter' (polling consumer) is now set to: JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT. The value can be explicitly overridden via the 'receive-timeout' attribute --- .../integration/jms/config/JmsAdapterParserUtils.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsAdapterParserUtils.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsAdapterParserUtils.java index 06df385f98..9e1e6a00c7 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsAdapterParserUtils.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/config/JmsAdapterParserUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 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,6 +22,7 @@ import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.integration.config.xml.IntegrationNamespaceUtils; +import org.springframework.jms.core.JmsTemplate; import org.springframework.util.StringUtils; /** @@ -124,7 +125,13 @@ abstract class JmsAdapterParserUtils { IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "priority"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delivery-persistent"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "explicit-qos-enabled"); - IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "receive-timeout"); + String receiveTimeout = element.getAttribute("receive-timeout"); + if (StringUtils.hasText(receiveTimeout)) { + builder.addPropertyValue("receiveTimeout", receiveTimeout); + } + else { + builder.addPropertyValue("receiveTimeout", JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT); + } Integer acknowledgeMode = parseAcknowledgeMode(element, parserContext); if (acknowledgeMode != null) { builder.addPropertyValue("sessionAcknowledgeMode", acknowledgeMode);