Skip to content
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

TODOs for Cross-Languaged RPC #48

Open
1 of 3 tasks
jovany-wang opened this issue Oct 22, 2020 · 2 comments
Open
1 of 3 tasks

TODOs for Cross-Languaged RPC #48

jovany-wang opened this issue Oct 22, 2020 · 2 comments

Comments

@jovany-wang
Copy link
Owner

jovany-wang commented Oct 22, 2020

  • Handle the overloading of methods.
  • Auto-handle the schema of a method(args and return type, etc).
  • Custom class arguments and return type for both Cpp and Java.
@jovany-wang
Copy link
Owner Author

Java RPC Server

  1. Extract Executor implementation
class Executor {
    Executor(std::function<void(std::buffer &encoded_bytes)> func) :on_request_coming_callback_(func) {
    }

    std::function<void(std::buffer &encoded_bytes)> on_request_coming_callback_;
};
  1. C++ RPC Server
class RpcServer {
    void CreateService(service_name service) {
 
    }
    
    Executor executor_ = Executor([](std::buffer &encoded_byte) {
         auto rpc_request = codec_.decode();
         str service = rpc_request.service_name();
         str method = rpc_request.method_name();
         tuple args = rpc_request.args();
         Invoke(service, method, args);
    });

    CppCodec codec_;
    map<service_name, service_instance> services_;
};

@jovany-wang
Copy link
Owner Author

Since we should write much code for JNI implementation. It's more graceful to use netty for Java if we define the protocol.

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

No branches or pull requests

1 participant