-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-8704: Add global property for defaultTimeout
#8706
Conversation
Fixes spring-projects#8704 The default timeout for requests and replies in the integration endpoints is 30 seconds to avoid indefinite blocking in threads. Sometime those 30 seconds is not enough. * Introduce a `spring.integration.endpoints.defaultTimeout` global property to allow overriding all the timeouts to desired value. The negative number indicates an indefinite waiting time: similar to what was there before introducing 30 seconds by default
@@ -406,6 +406,13 @@ protected void onInit() { | |||
} | |||
this.messageConverter.setBeanFactory(beanFactory); | |||
} | |||
long endpointsDefaultTimeout = getIntegrationProperties().getEndpointsDefaultTimeout(); | |||
if (!this.requestTimeoutSet) { | |||
this.messagingTemplate.setSendTimeout(endpointsDefaultTimeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? Previously, the send timeout still defaulted to -1. Based on the docs, I assume yes. It makes sense to apply it, but I wonder if two properties are needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was like this in the ctor:
template.setSendTimeout(IntegrationContextUtils.DEFAULT_TIMEOUT);
Yes, it was -1
before 6.1
.
Not sure what you are asking about two props, though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just wondering if we need a default send timeout as well as a default reply timeout property; since they are two different things; the send timeout is, for example, if a bounded QueueChannel
is full whereas the reply timeout is for a request/reply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean, but from end-user waiting perspective it looks the same, therefore I believe just a single default property is enough.
You can always override per endpoint and per property if there is a different requirements for send and receive.
@@ -217,6 +216,9 @@ protected void onInit() { | |||
} | |||
this.messagingTemplate.setDestinationResolver(getChannelResolver()); | |||
setAsyncIfCan(); | |||
if (!this.sendTimeoutSet) { | |||
this.messagingTemplate.setSendTimeout(getIntegrationProperties().getEndpointsDefaultTimeout()); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
src/reference/antora/modules/ROOT/pages/configuration/global-properties.adoc
Outdated
Show resolved
Hide resolved
src/reference/antora/modules/ROOT/pages/configuration/global-properties.adoc
Outdated
Show resolved
Hide resolved
Co-authored-by: Gary Russell <grussell@vmware.com>
Fixes #8704
The default timeout for requests and replies in the integration endpoints is 30 seconds to avoid indefinite blocking in threads. Sometime those 30 seconds is not enough.
spring.integration.endpoints.defaultTimeout
global property to allow overriding all the timeouts to desired value. The negative number indicates an indefinite waiting time: similar to what was there before introducing 30 seconds by default