Skip to content

Add setRetryStrategy to ApacheHttpClient5TransportBuilder - #2086

Merged
reta merged 4 commits into
opensearch-project:mainfrom
loggk:feat/http5-retry-strategy
Aug 11, 2026
Merged

Add setRetryStrategy to ApacheHttpClient5TransportBuilder#2086
reta merged 4 commits into
opensearch-project:mainfrom
loggk:feat/http5-retry-strategy

Conversation

@loggk

@loggk loggk commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

The builder unconditionally calls disableAutomaticRetries() on the underlying HttpAsyncClientBuilder. In HttpClient 5 this flag cannot be undone, so a retry strategy set through HttpClientConfigCallback is silently ignored and there is no supported way to enable retries.

This adds a setRetryStrategy(HttpRequestRetryStrategy) option to the builder. When set, the strategy is passed through to the http client; when not set, retries stay disabled as before, keeping the default behavior on par with the 4.x http client.

A new RetryStrategyTest verifies both behaviors against a local socket server that fails the first request with a 503: with a retry strategy the request is transparently retried and succeeds, and by default the failure surfaces without a retry.

Issues Resolved

Fixes #1738

  • New functionality includes testing
  • API changes companion pull request created, if applicable
  • Commits are signed per the DCO using --signoff
  • Public documentation issue/PR created, if applicable

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Logan Kennedy <kennedylogan22@gmail.com>
@loggk
loggk force-pushed the feat/http5-retry-strategy branch from cbbb23c to 808d243 Compare August 11, 2026 00:49
@loggk
loggk requested a review from reta August 11, 2026 01:37

@reta reta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @loggk !

Signed-off-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: Andriy Redko <drreta@gmail.com>
reta
reta previously approved these changes Aug 11, 2026
Signed-off-by: Andriy Redko <drreta@gmail.com>
@reta
reta merged commit e421982 into opensearch-project:main Aug 11, 2026
47 checks passed
reta added a commit that referenced this pull request Aug 11, 2026
)

* Allow enabling automatic retries in ApacheHttpClient5TransportBuilder



* Apply suggestion from @reta



* Apply suggestion from @reta



* Apply suggestion from @reta



---------




(cherry picked from commit e421982)

Signed-off-by: Logan Kennedy <kennedylogan22@gmail.com>
Signed-off-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com>
Co-authored-by: Logan Kennedy <163435909+loggk@users.noreply.github.com>
Co-authored-by: Andriy Redko <drreta@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Retries disabled in HTTP client builder.

2 participants