Skip to content

Add Apache HttpClient 5.x adapter support #3612

@uuuyuqi

Description

@uuuyuqi

Issue Description

Type: feature request

Describe what happened (or what feature you want)

Sentinel currently only supports Apache HttpClient 4.x via sentinel-apache-httpclient-adapter. However, Apache HttpClient 5.x has been the recommended version since 2020, and HttpClient 4.x is now in maintenance mode.

I'd like to propose adding a new sentinel-apache-httpclient5-adapter module to support flow control for outgoing HTTP requests made with Apache HttpClient 5.x.

Key design points

  • Integration approach: Implement ExecChainHandler interface (HttpClient 5.x API), registered via HttpClientBuilder.addExecInterceptorBefore(). This is the idiomatic way to intercept requests in HttpClient 5.x, compared to the decorateMainExec() approach used in the 4.x adapter.
  • Resource naming: Default format is METHOD:url with query string and fragment stripped, consistent with the existing OkHttp adapter (DefaultOkHttpResourceExtractor).
  • Extension points: Same pattern as the existing 4.x adapter — pluggable ApacheHttpClientResourceExtractor for custom resource naming, ApacheHttpClientFallback for custom block handling.
  • Minimum HttpClient version: 5.1 (provided scope dependency).

Describe what you expected to happen

A new module sentinel-apache-httpclient5-adapter is available for users who use Apache HttpClient 5.x.

Tell us your environment

  • Sentinel version: master (2.0.0-alpha2-SNAPSHOT)
  • Apache HttpClient 5.1+
  • JDK 8+

Anything else we need to know?

I have an implementation ready and will submit a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/integrationsIssues or PRs related to integrations with open-source componentskind/featureCategory issues or prs related to feature request.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions