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

airframe-http: Use HttpMessage.Request/Response as the standard interface #2167

Closed
xerial opened this issue May 10, 2022 · 1 comment
Closed

Comments

@xerial
Copy link
Member

xerial commented May 10, 2022

Historically, we needed to manage various http request/response types of Finagle, OkHttp, etc. Now that airframe-http has its own HttpMessage.Request/Response types, we should be able to wrap backend-specific request/response types into the unified http requests and responses.

Converting backend specific requests (e.g., Fingagle request) to HttpMesage.Request is not expensive. Currently, using backend-specific implementation has much higher cost.

Projects using backend-specific request/response types:

  • airframe-http-okhttp
  • airframe-http-finagle
  • airframe-http-recorder
  • airframe-http-grpc

Benefits:

  • We can use the same filters both for finagle and gRPC (e.g., auth filter, header manipulation filter, etc.)
  • Simplify the usage of http-recorder, okhttp, etc.

Steps:

  • Add a new factory methods in each projects
  • Preserve the current interfaces for a while so as not to break the existing code
@xerial xerial added this to the Airframe 22 milestone May 10, 2022
xerial added a commit that referenced this issue May 26, 2022
)

- Add Java11 http client airframe-http #1543
- Using standard request/response methods in airframe-http:n #2167
- Add circuit breaker #874
xerial added a commit that referenced this issue May 27, 2022
…and Scala.js (#2190)

With this change, we can use the same Http.client.newSync/AsyncClient interface both for Scala JVM and JS.

- Gradually reducing the usage of rich GET/POST/PUT methods with object conversion. This is because airframe-rpc only need to use POST method. If we need such rich HTTP methods, airframe-http-finagle or okhttp can be used for a while. For the default use cases, we will use the default JVM HttpClient or the Scala.js specific implementation without rich HTTP request/response conversions.
   - URLConnectionClient is changed to implement the new SyncClient interface and dropped rich HTTP method support.
- The new Sync/AsyncClient interface has rpc[Req, Resp] method, which will be used in code generator. We will be able to use the same RPC client code both for Scala JVM and Scala.js

Related: #2167 #2140
@xerial xerial modified the milestones: Airframe 22, Airframe 23 Apr 24, 2023
xerial added a commit that referenced this issue Apr 25, 2023
- [x] Use Netty-backend server
- [x] Introduce Rx-based filter #2591 
- [x] Change interface to use HttpMessage.Request/Response #2167
@xerial
Copy link
Member Author

xerial commented May 25, 2023

done

@xerial xerial closed this as completed May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants