-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Update retrieve() in RestClient to execute and extract in single scope #33777
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
Comments
Could this behavior change be mentioned in the changelog? 🙏 |
@fmasa can you elaborate which behavior change surprised you while upgrading? |
@bclozel The 6.2.0 changed the behavior of We had one fire&forget request that stopped being called after upgrading to Spring 6.2.0 and when going through release notes I did not find any mention of this. 🙂 |
Thanks, I'll add a note in the release notes. Out of curiosity: we added an annotation to warn people about this in #33818. IDEs should highlight this on your screen. Does it work for you? I know this doesn't replace a warning in the release notes but just wanted to make sure this shows for future usages. |
@bclozel Thanks a lot 🙇 |
For the annotation: I don't see anything in IDEA. But quick search shows that it's not supported there yet?. We also use detekt which catches that 🙂 |
@rstoyanchev The commit for this change also introduced the |
|
Thanks. So just to clarify: If we make sure that our convert callback does not return |
Uh oh!
There was an error while loading. Please reload this page.
The
retrieve()
workflow inRestClient
splits the exchange over two method calls. The call toretrieve()
executes the request but doesn't extract, and the subsequent call to one of theResponseSpec
methods actually extracts the response.This makes sense but it's also reasonable to conclude you can just call
retrieve()
if you don't care for the response. In that case, however, the observation scope remains open, the status is not checked, and the connection is not closed.retrieve()
should merely a step towards fully declaring the exchange before, and only once aResponseSpec
method is selected should we proceed with execution and response extraction. Same way it works with the RestTemplate.This will make the
retrieve()
workflow a true shortcut for callingexchange()
, fully scoped within a call toexchange()
with a built-inExchangeFunction
based on theResponseSpec
selection. If an application actually wants to split execution and extraction into separate steps, it can use theexchange
variants.The text was updated successfully, but these errors were encountered: