From 7807e0ec5965292235ed7eac80034965405a1669 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 26 Oct 2020 15:48:51 -0400 Subject: [PATCH] GH-3301: Improve JMS receiveTimeout docs Fixes https://github.com/spring-projects/spring-integration/issues/3301 Explain in docs how to configure a `JmsTemplate.receiveTimeout(-1)` --- src/reference/asciidoc/jms.adoc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/reference/asciidoc/jms.adoc b/src/reference/asciidoc/jms.adoc index f3df38edf9..c28e217bd1 100644 --- a/src/reference/asciidoc/jms.adoc +++ b/src/reference/asciidoc/jms.adoc @@ -87,6 +87,17 @@ If you prefer to have the raw JMS message as the Spring Integration message's pa ==== Starting with version 5.0.8, a default value of the `receive-timeout` is `-1` (no wait) for the `org.springframework.jms.connection.CachingConnectionFactory` and `cacheConsumers`, otherwise it is 1 second. +The JMS Inbound Channel Adapter crates a `DynamicJmsTemplate` based on the provided `ConnectionFactory` and options. +If an external `JmsTemplate` is required (e.g. in Spring Boot environment), or `ConnectionFactory` is not caching, or no `cacheConsumers`, it is recommended to set `jmsTemplate.receiveTimeout(-1)` if a non-blocking consumption is expected: + +==== +[source,java] +---- +Jms.inboundAdapter(connectionFactory) + .destination(queueName) + .configureJmsTemplate(template -> template.receiveTimeout(-1)) +---- +==== [[jms-ib-transactions]] ==== Transactions