Skip to content

Remove HttpPipelineNextPolicy #40084

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

Closed
wants to merge 174 commits into from

Conversation

vcolin7
Copy link
Member

@vcolin7 vcolin7 commented May 8, 2024

Fixes: #39841.

Removed HttpPipelineNextPolicy and HttpPipelineCallState. Refactored HttpPipelinePolicy so it knows the next policy in the chain.

samvaity and others added 30 commits October 11, 2023 16:46
- Moved some HTTP classes from `http` package to `http.models`.
- Renamed `HttpHeader` and `HttpHeaders` to `Header` and `HttpHeader`, respectively. Also moved them to the `models` package.
- Removed @deprecated methods.
- Removed "Sync" suffix from most classes and methods.
- Added necessary classes to `implementation` package.
…s classes and interfaces in `implementation.serializer`.
…s, Client Logger methods, sync suffix, API view comments
@vcolin7 vcolin7 requested review from lmolkova and g2vinay May 8, 2024 20:28
@vcolin7 vcolin7 self-assigned this May 8, 2024
@samvaity samvaity force-pushed the feature/generic-sdk-core-2 branch from 32be336 to c117833 Compare May 8, 2024 22:41
*
* @return A response produced from sending the HTTP request.
*/
public Response<?> process(HttpRequest httpRequest, HttpPipeline httpPipeline) {
Copy link
Member

Choose a reason for hiding this comment

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

If we're going to be changing the API to remove HttpPipelineNextPolicy I think we should do a major break here instead of trying to retain a similar flow as azure-core. Right now, each pipeline has a mutable state with nextPolicy and HttpPipeline is supposed to be thread-safe which this will break. If two requests are being made where a common RetryPolicy is shared between two pipelines the nextPolicy may not point to the right following policy.

What I'll propose, split process into two methods, onRequest(HttpRequest) : HttpRequest and onResponse(HttpResponse) : HttpResponse. This makes HttpPipelinePolicy a stateless call and removes, what I believe wasn't a great pattern before, where the pipeline policy was both a mutator of requests and responses and managed a small bit of state management as it was forced to call HttpPipelineNextPolicy.process, and if it didn't now it broke the HttpPipeline call.

Simplifying HttpPipelinePolicy to onRequest and onResponse removes state management. It no longer needs to make a call to process the next policy, allowing the HttpPipelinePolicy to be a request and response mutator and HttpPipeline completely owns the state management. This would also allow for policies to be extended into more responsibilities in the future such as onException, if we find additional requirements (though I believe onRequest and onResponse would be sufficient for a long time).

Base automatically changed from feature/generic-sdk-core-2 to main May 13, 2024 23:27
Copy link
Contributor

Hi @vcolin7. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days.

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue. label Aug 16, 2024
Copy link
Contributor

Hi @vcolin7. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing /reopen if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the no-recent-activity label; otherwise, this is likely to be closed again with the next cleanup pass.

@github-actions github-actions bot closed this Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. clientcore no-recent-activity There has been no recent activity on this issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update HTTP pipelines and policies API
5 participants