dousi

Native Multiple Languages RPC Framework.

Stars
6

dousi-rpc

GitHub Workflow Status Github Star Number Highly Performance RPC Framework.

Note that this is working on progress.

Features

  • Multiple languages server.
  • Dynamic schema and dynamic signature validation.
  • Optimize transferring the large size data to many remote ends.
  • Compiling safe both in C++ server and client.

Pure C++ Usage

C++ Server

class Calculator {
public:
    int add(int x, int y) {
        return x + y;
    }

    int sub(int x, int y) {
        return x - y;
    }
};

int main() {

    dousi::Init(/*master=*/"127.0.0.1:100001");

    auto my_service = dousi::CreateService<Calculator>();
    const auto add_rm = dousi::Remote(&Calculator::add);
    adder_service.RegisterMethod(add_rm);
    adder_service.RegisterMethod(dousi::Remote(&Calculator::sub));

    dousi::Loop();

    return 0;
}

C++ Client

int main() {
    dousi::Init(/*master=*/"127.0.0.1:100001");

    ServiceHandle calc_service = dousi::GetService<Calculator>();
    
    DousiFuture<int> sum_future = calc_service.Call(dousi::Remote(&Calculator::add), 2, 3);
    DousiFuture<int> sub_future = calc_service.Call(dousi::Remote(&Calculator::sub), 10, 3);
    
    std::cout << "2 + 3 = " << *sum_future.Get() << std::endl;
    std::cout << "10 - 3 = " << *sub_future.Get() << std::endl;
    return 0;
}

Cross-Languaged RPC

Java Async-Server and Async-Client is supported now, and it's supported that a Java client connects to C++ server and a C++ client connects to a Java server. More information can be refered in Java Part of Dousi

Roadmap

  • Prototype of C++ implementation
  • Prototype of Java async server and client
  • Optimize large data transferring
  • Support multiple languages servers
  • Optimize buffer-shipping in process