Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate CoroutineContext to the CoExchangeFilterFunction #34555

Closed
wants to merge 1 commit into from

Conversation

dmitrysulman
Copy link
Contributor

This PR introduces a new WebClient.ResponseSpec.awaitEntityOrNull() extension function to replace WebClient.ResponseSpec.toEntity(...).awaitFirstOrNull() and pass the CoroutineContext from the outer scope to the CoExchangeFilterFunction#filter method.

CoroutineContext propagation is implemented via ReactorContext and ClientRequest attribute.

Any feedback is more than welcome.

Fixes #32148

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 7, 2025
@sdeleuze sdeleuze self-assigned this Mar 7, 2025
@sdeleuze sdeleuze added the theme: kotlin An issue related to Kotlin support label Mar 7, 2025
@sdeleuze sdeleuze added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Mar 20, 2025
@sdeleuze sdeleuze added this to the 7.0.0-M4 milestone Mar 20, 2025
@dmitrysulman dmitrysulman requested a review from sdeleuze March 20, 2025 10:36
@sdeleuze sdeleuze requested review from sbrannen and removed request for sdeleuze March 20, 2025 10:45
@sdeleuze sdeleuze added the status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team label Mar 20, 2025
@dmitrysulman dmitrysulman requested a review from sdeleuze March 21, 2025 12:47
@sdeleuze sdeleuze removed the status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team label Mar 21, 2025
Copy link

@pankratz76 pankratz76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done

Copy link
Contributor

@sdeleuze sdeleuze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for refining the PR, please check my latest additional feedback.

This commit introduces a new ResponseSpec.awaitEntityOrNull() extension
function to replace ResponseSpec.toEntity(...).awaitFirstOrNull() and pass
the CoroutineContext to the CoExchangeFilterFunction.

CoroutineContext propagation is implemented via ReactorContext and
ClientRequest attribute.

See spring-projectsgh-32148

Signed-off-by: Dmitry Sulman <dmitry.sulman@gmail.com>
Copy link
Contributor

@sdeleuze sdeleuze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for taking in account the feedback, I will merge it shortly.

@sdeleuze sdeleuze removed the request for review from sbrannen March 26, 2025 08:20
@dmitrysulman
Copy link
Contributor Author

@sdeleuze Thanks for your feedback and guidance, I really appreciate it.

sdeleuze added a commit to sdeleuze/spring-framework that referenced this pull request Mar 26, 2025
@sdeleuze sdeleuze closed this in 00b88ec Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) theme: kotlin An issue related to Kotlin support type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Coroutine Contexts not propagated in WebClient client filter
5 participants