OpenFeign / OpenFeign/feign

AsyncApacheHttp5Client : Proposal to make creating the callback FutureCallback<SimpleHttpResponse>> through a public factory method

Open
#2,439 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

proposal
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

Hello,
I was faced with the problem to save thread-dependent data from the request-thread in an asynchronous httpclient-dispatch thread, for correctly output the necessary information in the Slf4jLogger logs, for example parentRequestId
The point of intersection of these threads is creation FutureCallback> - here thread-dependent information from request-thread can be stored in the callback for an asynchronous thread
I make workaround - I implemented this by proxying the class CloseableHttpAsyncClient and reflectively replacing the callback to its wrapper, with the necessary information from the request-thread to async
However, it would be convenient to have a public factory in the class with the ability to replace this factory to your own, for more convenient creation of a wrapper over a callback.
I suggest this code:
https://github.com/predatoralpha/AsyncApacheHttp5Client_proposal/blob/main/AsyncApacheHttp5Client.java
Here the factory is implemented via BiFunction<Request, CompletableFuture, FutureCallback>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AsyncApacheHttp5Client callback creation path and compare it with the linked AsyncApacheHttp5Client.java proposal. Determine how a public, replaceable factory would receive the request and future context; done means callers can supply a callback wrapper without proxying or reflection while asynchronous responses continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.