AsyncApacheHttp5Client : Proposal to make creating the callback FutureCallback<SimpleHttpResponse>> through a public factory method
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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