Add support for streaming on requests (and add better handling for streaming in responses)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Stack tecnologico
- java
- Ambito
- backend-api-design
Direzione di ricerca
Inizia con Response.Body e Client.Default, quindi esamina le implementazioni del logger e le implementazioni asincrone menzionate nell’issue. Leggi prima l’issue collegata e gli streaming shim esistenti per stabilire le decisioni relative all’API e al ciclo di vita. Il lavoro è completato quando è disponibile un design concordato per lo streaming delle richieste e delle risposte, inclusi la chiusura del body, il logging, la codifica/decodifica, la possibilità di ritentare e il comportamento asincrono.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Related issue - my apologies if this is a double post - I wasn't sure how to make sure the discussion was being viewed by the appropriate people: https://github.com/OpenFeign/feign/issues/1243
Problem
Feign currently uses a byte[] when processing the request body. This does not work for transfers of large request bodies (for example, uploading large files).
Requested solution
Make request bodies be designed around streams.
Status/Findings
I just finished up creating a bunch of shims to make streaming requests work in Feign, and would like to see if ya'll would be open to having a discussion about how to make this part of the main library. This works, but it is ugly.
Doing this properly will require a breaking change, so I am hesitant to create a pull request without some good discussion about the best way to do it, where we can and can't break API, etc...
Possible Approach
Based on the workaround implementation I created, I believe that the general approach will be as follows:
First, the existing Response.Body class is perfectly suitable for handing both Request and Responses. It actually looks like Response.Body was designed with this in mind. I think that refactoring this into a standalone Body interface, with concrete implementations for ByteArrayBody, InputStreamBody, NoContentBody, and possibly a FileContentBody. I also suggest removing calls specific to encoding, etc... from this class. I would like to get rid of null checks on the body parameter and just use a no-op NoContentBody if possible.
Next, there will be some surgical changes to Client.Default (for requests, we need to write a stream instead of a byte[])
There are some questions about calling close() (or not calling close() ) at the end of the response.
Another big impact area is going to be in logger implementations (which need to either not do body logging on streamed bodies, or need to use a different approach that monitors the stream but does not actually read the stream as part of the logging call).
And I think there should be some discussion about supporting InputStream as a body parameter type, and possibly OutputStream as a client method response parameter type. Maybe these could be handled with specialized encoder/decoder implementations, but it's worth discussion about whether these should be part of the core library. Might also discuss a File type as a body parameter type (this would allow setting content-length header and make the body retryable, which would worthwhile.
Finally, all of my work has been on the synchronous implementations - so evaluation with respect to Async will be needed.
Conclusion
All in all, while the design discussion will be important, I am confident that it is possible to make this change without massive amounts of surgery. And I think this would be a huge enhancement to Feign. This is a huge gap with Jax-RS that would be good to close.
Is there interest in pursuing this? I'm happy to do the grunt work on the pull request, but I think this is a big enough breaking change that there should be discussion to get the design right before I start slinging code.
- Lingua principale
- Java
- Stelle
- 9.8k
- Fork
- 2k
- Merge medio
- 1h 15m
- PR unite (30g)
- 39
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenFeign/feign
-
DefaultAsyncClient never completes the returned future when Client throws ErrorForse già presa @hutiefang76 l’ha presa 14 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Response.charset ignores charset after another Content-Type parameterForse già presa @hutiefang76 l’ha presa 14 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
UriUtils ignores allowReservedCharacters=false when the input has no percent tripletForse già presa @hutiefang76 l’ha presa 14 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Java11 Http2Client loses response header value order and duplicate occurrencesForse già presa @hutiefang76 l’ha presa 14 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Java11 Http2Client rejects documented zero connect and read timeoutsForse già presa @hutiefang76 l’ha presa 14 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenFeign/feign
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
Shweit/EtherealPortals#30 ·
-
Typo in jakartaee-bom 12.0.0-SNAPSHOT with cdiForse già presa @ElectLive l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
jakartaee/jakartaee-api#205 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
liberation-data/drivine4j#547 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
BindingServiceProperties.bindings regressed to a non-thread-safe TreeMap in GH-3158: concurrent first use of binding names corrupts itForse già presa @AkashB23 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
spring-cloud/spring-cloud-stream#3321 ·
I maintainer di solito rispondono entro 1 giorno