-
Notifications
You must be signed in to change notification settings - Fork 20
feat(host): Introduce outbound transport system with initial gRPC client support #115
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
base: main
Are you sure you want to change the base?
Conversation
bb40063 to
8f4166d
Compare
64f4708 to
2018879
Compare
2932621 to
c68d37a
Compare
|
Hey @lxfontes @ricochet this PR is ready for a review! |
| &mut self.http | ||
| } | ||
|
|
||
| fn send_request( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nuances in this plugin selection code:
It expects/forces crate::plugin::wasi_grpc_client::GrpcClient or crate::plugin::wasi_http_client::HttpClient, which is not the expectation to downstream consumers ( ex: wash host ).
It relies on specific plugin names ( "grpc-client" ).
We need a bit more surgery to get this cleanly, specifically around HostPlugin trait and Ctx structure so we can walk thru bound plugins & get their http client.
With that, the logic in here would move to wasi_http plugin itself instead of split between 2 plugins.
Let me address this HostPlugin / Ctx situation in a PR and get back to you here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getting the code up in #156
I've left comments where the HTTP / GRPC logic would come in.
should be done with it on monday
gRPC calls This is largely based on: wasmCloud#115
gRPC calls This is largely based on: wasmCloud#115
gRPC calls This is largely based on: wasmCloud#115
gRPC calls This is largely based on: wasmCloud#115
c68d37a to
3faaefb
Compare
80a531d to
a8151cb
Compare
| wasmcloud_component::http::Response<impl wasmcloud_component::http::OutgoingBody>, | ||
| > { | ||
| // Use tokio to run the async code in a blocking context | ||
| let runtime = tokio::runtime::Builder::new_current_thread() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to use tokio? or maybe use wit_bindgen block_on?
| wasmcloud_component::http::Response<impl wasmcloud_component::http::OutgoingBody>, | ||
| > { | ||
| // Use tokio to run the async code in a blocking context | ||
| let runtime = tokio::runtime::Builder::new_current_thread() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to use tokio? or maybe use wit_bindgen block_on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly the wit_bindgen::block_on() does get our component to compile, It fails to run :( I'll ask around if this is expected behaviour or not but definitely worth the look, we should stick to using tokio here since I couldn't find other ways to bridge the sync-async of incoming-handler and the gRPC invocations (which are async).
a8151cb to
61c390f
Compare
gRPC calls This is largely based on: wasmCloud#115
32ec2c8 to
9015338
Compare
9015338 to
2295f90
Compare
|
Hey @lxfontes, cc linking keeps flaking for the wash ubuntu workflow, what can be done ? |
bdb51bf to
654c89d
Compare
aa7c055 to
b768a08
Compare
|
@lxfontes I've revamped the outgoing handler, it's no longer modular and now added as default in the HttpServer, this PR is good for a review!! |
…itial gRPC client support - Add `OutgoingHandler` trait to enable pluggable transport protocols - Implement `CompositeOutgoingHandler` for automatic protocol routing - Add gRPC client handler with HTTP/2, TLS, and h2c support - Move transport configuration ownership to `HttpServer` - Ensure full backward compatibility for existing HTTP-only hosts Signed-off-by: Aditya <aditya.salunkh919@gmail.com>
Signed-off-by: Aditya <aditya.salunkh919@gmail.com>
…hanisms default Signed-off-by: Aditya <aditya.salunkh919@gmail.com>
b768a08 to
af1b8c6
Compare
|
CC @lxfontes |
|
it seems the build error originated because of a conflicting dependency caused due to |
…om wash-wasi Signed-off-by: Aditya <aditya.salunkh919@gmail.com>
6932c70 to
a905135
Compare
Feature or Problem
This PR adds
modulartransport protocol support to the HTTP server plugin, with gRPC client support as the first implementation. The new architecture allows WebAssembly components to make outgoing requests using different transport protocols (HTTP/1.1, HTTP/2, gRPC, etc.) through a pluggable handler system.Key Changes:
OutgoingHandlertrait - Extensible interface for adding transport protocolsCompositeOutgoingHandler- Chain-of-responsibility pattern for automatic protocol routingHttpServer, notHostBuilderComponents can now make gRPC calls using the wasmcloud-grpc-client helper crate, and the runtime automatically routes requests to the appropriate transport based on headers and URI schemes.
Related Issues
Closes #112
Release Information
Target:
nextreleaseArchitecture
Usage Example:
Handler Chain:
Consumer Impact
No Breaking Changes:
Future Extensibility:
This architecture makes it trivial to add new transport protocols without modifying core structures:
Testing
Unit Tests
Integration Tests
Added three comprehensive integration tests using a test gRPC server and example component (
grpc_hello_world.wasm):test_grpc_client_basiccontent-type: application/grpcheader handlingtest_grpc_client_concurrenttest_grpc_client_error_handlingManual Verification
Local Test Execution:
Result: ✅ All tests pass successfully
Test Output Verification:
Benefits
HttpServerorHostBuilderFuture Work
This architecture enables future protocol support with minimal changes:
internal://service-name)Each new protocol only requires implementing the
OutgoingHandlertrait so no changes to core infrastructure needed.