Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9e80777
feat: add raw unary runtime core
CoderSerio Jul 15, 2026
7de774a
feat: add node native napi binding crate
CoderSerio Jul 15, 2026
9ae78cd
refactor: rename runtime facade to dubbo rs core
CoderSerio Jul 15, 2026
3db8408
refactor: keep napi binding out of rust core workspace
CoderSerio Jul 15, 2026
96adcc3
feat: add raw unary timeout to core
CoderSerio Jul 15, 2026
b390c01
feat: expose static endpoint list in core
CoderSerio Jul 15, 2026
7ef071d
feat: add registry constructor to core
CoderSerio Jul 15, 2026
905a208
feat: support configurable load balancing
CoderSerio Jul 15, 2026
2aec41d
feat: support configurable cluster strategy
CoderSerio Jul 15, 2026
a208f61
feat: route providers by tag
CoderSerio Jul 15, 2026
d8dfe6b
feat: route providers by group and version
CoderSerio Jul 15, 2026
c4d4bf3
fix: preserve routing status errors
CoderSerio Jul 15, 2026
3abfa76
feat: support default raw unary timeout
CoderSerio Jul 16, 2026
0169702
feat: expose raw status details
CoderSerio Jul 16, 2026
48957e3
docs: document dubbo rs core crate
CoderSerio Jul 16, 2026
04b999d
feat: support default raw metadata
CoderSerio Jul 16, 2026
a03e9cf
feat: configure failover retries
CoderSerio Jul 16, 2026
22b004c
feat: configure raw triple compression
CoderSerio Jul 16, 2026
3cad65c
feat: honor provider weight in random load balancer
CoderSerio Jul 16, 2026
ccbf219
feat: honor provider weight in round robin load balancer
CoderSerio Jul 16, 2026
9181e6c
feat: configure failover retry delay
CoderSerio Jul 16, 2026
457c61d
docs: document core crate publishing path
CoderSerio Jul 16, 2026
428d839
Add raw unary trailer support to core
CoderSerio Jul 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"registry/zookeeper",
"registry/nacos",
"dubbo",
"dubbo-rs-core",
"examples/echo",
"examples/greeter",
"dubbo-build",
Expand Down
30 changes: 30 additions & 0 deletions dubbo-rs-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "dubbo-rs-core"
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
description = "Stable core facade for embedding Dubbo Rust in other runtimes"
repository = "https://github.com/apache/dubbo-rust.git"
readme = "README.md"
keywords = ["dubbo", "triple", "rpc", "napi"]
categories = ["network-programming", "api-bindings"]

[dependencies]
bytes.workspace = true
dubbo = { path = "../dubbo", version = "0.4.0" }
dubbo-registry-nacos = { path = "../registry/nacos", version = "0.4.0", optional = true }
dubbo-registry-zookeeper = { path = "../registry/zookeeper", version = "0.4.0", optional = true }
http = "0.2"
tokio = { workspace = true, features = ["time"] }

[features]
default = []
registry-nacos = ["dep:dubbo-registry-nacos"]
registry-zookeeper = ["dep:dubbo-registry-zookeeper"]
registry = ["registry-nacos", "registry-zookeeper"]

[dev-dependencies]
http-body = "0.4.4"
hyper = { version = "0.14.26", features = ["full"] }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }
tower-service.workspace = true
89 changes: 89 additions & 0 deletions dubbo-rs-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# dubbo-rs-core

`dubbo-rs-core` is a small, byte-oriented facade for embedding Dubbo Rust in
other runtimes.

The crate is intentionally lower level than the generated Rust client APIs. It
keeps the host language in control of service descriptors, protobuf
serialization, and public API shape, while Rust owns Dubbo transport and
governance behavior such as Triple calls, registry discovery, load balancing,
cluster strategy, routing, and timeouts.

This boundary is useful for packages such as `dubbo-js`, where JavaScript should
keep the user-facing client API while a N-API addon reuses the Rust core.

## Current Surface

- Raw unary Triple requests and responses.
- Static provider endpoints.
- Registry-backed clients behind optional features.
- Request-level and client-default unary timeouts.
- Load balancing: `random`, `round_robin`, and `p2c`; `random` and
`round_robin` honor provider `weight` URL parameters.
- Cluster strategy: `failfast` and `failover`, with configurable failover
retries and retry delay.
- Compression: `gzip` or `identity`.
- Metadata routing for tag, group, and version.
- Stable status code and message access for host-language error mapping.

## Features

- `registry-nacos`: enable Nacos registry support.
- `registry-zookeeper`: enable Zookeeper registry support.
- `registry`: enable all registry backends currently wired into this crate.

## Publishing And Host Usage

This crate is intended to be consumed by host-language bindings, such as a
Node.js N-API package. During local development those bindings can depend on the
crate by path. After publishing, switch them to a normal version dependency and
enable only the registry features they need:

```toml
dubbo-rs-core = { version = "0.1", features = ["registry"] }
```

The crate keeps protobuf encoding and generated service shape outside the Rust
boundary. Host runtimes pass raw request bytes, metadata, and endpoint or
registry options into Rust, then decode raw response bytes themselves.

## Example

```rust
use bytes::Bytes;
use dubbo_rs_core::{
RawMetadata, RawTripleClient, RawTripleClientOptions, RawUnaryRequest,
};

# async fn call() -> Result<(), Box<dyn std::error::Error>> {
let mut client = RawTripleClient::from_static_endpoints_with_options(
["http://127.0.0.1:50051?interface=example.EchoService"],
RawTripleClientOptions {
timeout_ms: Some(3_000),
load_balance: Some("round_robin".to_string()),
cluster: Some("failfast".to_string()),
failover_retries: None,
failover_retry_delay_ms: None,
compression: Some("gzip".to_string()),
..RawTripleClientOptions::default()
},
)?;

let response = client
.unary(RawUnaryRequest {
service: "example.EchoService".to_string(),
method: "Echo".to_string(),
path: "/example.EchoService/Echo".to_string(),
metadata: RawMetadata::new().insert("tri-service-group", "default"),
body: Bytes::from_static(b"\x0a\x05hello"),
timeout_ms: None,
})
.await?;

let _bytes = response.body;
# Ok(())
# }
```

The request and response bodies are protobuf bytes. Host runtimes should encode
and decode messages using their own protobuf toolchain.
Loading
Loading