Skip to content

Add setRetryStrategy to ApacheHttpClient5TransportBuilder - #2086

Open
loggk wants to merge 1 commit into
opensearch-project:mainfrom
loggk:feat/http5-retry-strategy
Open

Add setRetryStrategy to ApacheHttpClient5TransportBuilder#2086
loggk wants to merge 1 commit 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 108c1ff to cbbb23c Compare August 3, 2026 18:34
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.

[BUG] Retries disabled in HTTP client builder.

1 participant