Skip to content

feat(wrpc): add transport abstraction and language-specific bindings (Phase 3+4)#343

Merged
avrabe merged 1 commit intomainfrom
wrpc-phase3-phase4-transport-abstraction
Feb 8, 2026
Merged

feat(wrpc): add transport abstraction and language-specific bindings (Phase 3+4)#343
avrabe merged 1 commit intomainfrom
wrpc-phase3-phase4-transport-abstraction

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Feb 8, 2026

Summary

This PR implements Phase 3 (Transport Abstraction Layer) and Phase 4 (Multi-Language Support) of the WRPC modernization effort (#332).

Phase 3 - Transport Abstraction Layer

  • Added WrpcTransportInfo provider for pluggable transport configuration
  • Created transport configuration rules with address validation:
    • tcp_transport: Direct TCP connections (host:port)
    • nats_transport: NATS.io messaging (nats://host:port)
    • unix_transport: Unix domain sockets (/path/to/socket)
    • quic_transport: QUIC protocol (host:port)
  • Updated wrpc_serve to accept transport attribute for type-safe configuration
  • Backward compatible with legacy string-based transport/address attributes

Phase 4 - Multi-Language Binding Support

  • Added wrpc_rust_bindings() macro for idiomatic Rust binding generation
  • Added wrpc_go_bindings() macro for idiomatic Go binding generation
  • Note: wit-bindgen-wrpc only supports Rust and Go (not Python/JavaScript)

Usage Examples

load("@rules_wasm_component//wrpc:transports.bzl", "tcp_transport")
load("@rules_wasm_component//wrpc:defs.bzl", "wrpc_serve", "wrpc_rust_bindings")

# Define transport configuration
tcp_transport(
    name = "dev_server",
    address = "localhost:8080",
)

# Serve a component
wrpc_serve(
    name = "serve",
    component = ":my_component",
    transport = ":dev_server",
)

# Generate Rust bindings
wrpc_rust_bindings(
    name = "calculator_client",
    wit = "//wit:calculator",
    world = "calculator-client",
)

Test plan

  • Build verification: bazel build //wrpc:defs //wrpc:transports //providers:providers
  • CI passes

Closes #332

🤖 Generated with Claude Code

…(Phase 3+4)

Phase 3 - Transport Abstraction Layer:
- Add WrpcTransportInfo provider for pluggable transport configuration
- Create transport rules: tcp_transport, nats_transport, unix_transport, quic_transport
- Each transport has address validation (host:port, nats://, absolute paths)
- wrpc_serve rule now accepts transport_config attribute for type-safe configuration
- Backward compatible with legacy transport/address string attributes

Phase 4 - Multi-Language Binding Support:
- Add wrpc_rust_bindings() macro for idiomatic Rust binding generation
- Add wrpc_go_bindings() macro for idiomatic Go binding generation
- Note: wit-bindgen-wrpc only supports Rust and Go (not Python/JavaScript)
- Updated documentation with usage examples

Usage examples:
  tcp_transport(name = "dev_server", address = "localhost:8080")
  wrpc_serve(name = "serve", component = ":my_comp", transport = ":dev_server")
  wrpc_rust_bindings(name = "calc_client", wit = ":calc.wit", world = "calc")

Closes #332

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@avrabe avrabe merged commit bb71509 into main Feb 8, 2026
27 checks passed
@avrabe avrabe deleted the wrpc-phase3-phase4-transport-abstraction branch February 8, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redesign: Modernize WRPC rules to follow Bazel best practices

1 participant