Skip to content
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

Merged
merged 2 commits into from
Aug 22, 2023

Conversation

artembilan
Copy link
Member

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.

  • 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

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
@artembilan artembilan requested a review from garyrussell August 22, 2023 16:34
@@ -406,6 +406,13 @@ protected void onInit() {
}
this.messageConverter.setBeanFactory(beanFactory);
}
long endpointsDefaultTimeout = getIntegrationProperties().getEndpointsDefaultTimeout();
if (!this.requestTimeoutSet) {
this.messagingTemplate.setSendTimeout(endpointsDefaultTimeout);
Copy link
Contributor

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?

Copy link
Member Author

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...

Copy link
Contributor

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.

Copy link
Member Author

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());
}
Copy link
Contributor

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/whats-new.adoc Outdated Show resolved Hide resolved
Co-authored-by: Gary Russell <grussell@vmware.com>
@artembilan artembilan requested a review from garyrussell August 22, 2023 20:50
@garyrussell garyrussell merged commit d85c5e3 into spring-projects:main Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide properties to block threads by default (again)
2 participants