Skip to content

About

Dubbo Rust Hybrit Consumer Project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

java-rust-dubbo

English | Türkçe

Release REST Line Java

A lightweight, generated-client Dubbo consumer library for Rust-Java REST services.

Call Dubbo providers from Java 21 REST handlers with a Rust native TCP transport — without pulling Apache Dubbo, Netty, Spring Boot, or ZooKeeper into your process.


Key Features

  • Compile-time client generation: Declare typed Dubbo clients with @NativeDubboClient; no dynamic proxies or reflection on the hot path.
  • Native Rust transport: Connection pooling, heartbeats, deadlines, and backpressure run in Rust over JNI (Dubbo ABI 7).
  • Kubernetes-friendly static discovery: Point directly at a Kubernetes Service DNS name or static host:port list without ZooKeeper (ZooKeeper remains available as an opt-in).
  • Two transport modes: blocking for ultra-low RSS single-core pods, and tokio-demux for multiplexed high-concurrency async RPCs.
  • Native JSON response handles: Forward provider JSON bytes straight to HTTP via DubboResponses.replyAsync(...) without allocating intermediate Java arrays.

Quick Start (5 Minutes)

1. Add Maven Dependency

Recommended with rust-java-platform-parent (4.11.0):

<dependency>
  <groupId>com.reactor</groupId>
  <artifactId>rust-java-starter-dubbo</artifactId>
</dependency>

Or add java-rust-dubbo directly:

<dependency>
  <groupId>com.reactor</groupId>
  <artifactId>java-rust-dubbo</artifactId>
  <version>0.11.0</version>
</dependency>

2. Declare Your Generated Client

@NativeDubboClient(
    service = CustomerQueryService.class,
    version = "1.0.0"
)
public interface CustomerClients {}

3. Configure Provider Address (rust-spring.properties)

reactor.runtime.profile=micro-dubbo
reactor.dubbo.transport=native
reactor.dubbo.providers=customer-provider.default.svc.cluster.local:20880
reactor.dubbo.timeout-ms=1000
reactor.dubbo.retries=0

4. Call From a REST Handler

@RestController
public final class CustomerHandler {
    private final CustomerQueryServiceClient client;

    public CustomerHandler(CustomerQueryServiceClient client) {
        this.client = client;
    }

    @GetMapping("/api/customers/{id}")
    public CompletionStage<CustomerSummary> find(@PathVariable("id") long id) {
        return client.findByIdAsync(id);
    }
}

Tuning Guide

Choose Transport & Profile

Profile / Transport Best For Connections / Endpoint Async Workers Max In-Flight
micro-dubbo + blocking 1 CPU / 128 MiB pods, minimal RSS 1 1 32
low-rss + blocking Small 2 CPU services 2 2 64
balanced-dubbo + tokio-demux Multi-core high-concurrency async RPCs 16 8 512
throughput + tokio-demux Peak throughput on 4+ CPU hosts 32 16 1024

Recipe 1: Low-Memory Container (1 CPU / 128 MiB)

reactor.runtime.profile=micro-dubbo
reactor.dubbo.transport=native
reactor.dubbo.native-async-transport=blocking
reactor.dubbo.providers=provider-svc:20880
reactor.dubbo.native-connections-per-endpoint=1
reactor.dubbo.native-async-workers=1
reactor.dubbo.max-inflight=32
reactor.dubbo.timeout-ms=800
reactor.dubbo.retries=0

Recipe 2: High-Concurrency Async Consumer (2–4 CPU)

reactor.runtime.profile=balanced-dubbo
reactor.dubbo.transport=native
reactor.dubbo.native-async-transport=tokio-demux
reactor.dubbo.providers=provider-svc:20880
reactor.dubbo.native-connections-per-endpoint=4
reactor.dubbo.native-async-workers=4
reactor.dubbo.native-async-queue-capacity=512
reactor.dubbo.max-inflight=256
reactor.dubbo.timeout-ms=1200

Async tip: Keep CompletionStage continuations short and non-blocking. Never call .join() or .get() inside a completion callback — offload blocking work to a dedicated application executor.

Recipe 3: ZooKeeper Discovery (Optional)

reactor.dubbo.transport=native
reactor.dubbo.registry-address=zookeeper://zk-1:2181,zk-2:2181
reactor.dubbo.registry-root=dubbo
reactor.dubbo.registry-check=false

Documentation & Samples

About

Dubbo Rust Hybrit Consumer Project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages