Repository navigation
Conversation
…builder Resolve the declared Kotlin return type for suspend functions when the plain Feign.builder() path is used, so decoders no longer receive java.lang.Object. See issue OpenFeign#2019.
Cover both the blocking Feign.builder() path with KotlinDelegatingContract and the CoroutineFeign path (OpenFeign#2019).
Adds a README section explaining how to combine CoroutineFeign with truly non-blocking AsyncClient implementations (Http2Client, AsyncApacheHttp5Client) instead of the thread-pool based DefaultAsyncClient, with a regression test proving that decoding runs off the caller thread. Refs OpenFeign#2374
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR combines coroutine support improvements for Feign and adds a Spring WebClient-backed non-blocking transport:
KotlinDelegatingContract, which resolves Kotlin suspend return types with kotlin-reflect instead of exposing the JVM continuation signature (Object) to decoders. Regression tests cover this path.DefaultAsyncClientwraps a blocking client and show how to supply a non-blockingAsyncClient.Flow<T>(Support sse client #971) — decode the HTTP body as a bufferedList<T>and expose it as a coldFlow. This is not incremental HTTP/SSE streaming.feign-webflux— implementWebClientAsyncClient<C>as a FeignAsyncClientbacked by SpringWebClient. It accepts aWebClientorWebClient.Builder, reusing configured connectors, filters, codecs and transport settings. With Reactor Netty, requests use its event-loop resources; a suspended caller does not park a thread while awaiting the response. The transport completes the future asynchronously, and response bodies are aggregated before Feign decoding.Spring + CoroutineFeign usage
In Spring Boot WebFlux, the injected builder can carry the application's WebClient configuration. With the Reactor Netty connector, the application and client can share Reactor Netty's default event-loop resources. This adds manual Spring bean integration, not
@FeignClientauto-configuration forspring-cloud-openfeign.Behavior and compatibility notes
feign-webfluxrequires Java 17+ (Spring Framework 7 baseline). Adding this optional module does not change Feign Core's Java baseline.WebClient.Builderreaches the request.Flow<T>provides true streaming.Responsevalues forErrorDecoderhandling.Testing
./mvnw -pl webflux -am test -Dtoolchains.skip=true -Dtoolchain.skip=true -Dmaven.javadoc.skip=true -Dlicense.skip=true— 898 tests, 0 failures/errors, 4 skipped across core, Jackson, Java 11, Kotlin and WebFlux../mvnw -pl webflux license:check -Dtoolchains.skip=true -Dtoolchain.skip=true -Dmaven.javadoc.skip=true— passed.Fixes #2019
Fixes #2374
Closes #971 (buffered Flow semantics; true streaming left for discussion)