I released a framework for in-process microservices on Tokio runtime.
The difference between a previous work tarpc is that
- norpc only supports in-process microservices because I think gRPC should be used for the purpose of networking RPC. The name norpc comes from "not remote procedure call".
- norpc depends on
tower::Service
abstraction to exploits the assets in the ecosystem. - norpc supports
!Send
futures. - norpc is about 50% less overhead than tarpc.
Regarding 2, you can exploit any tower middleware on both client/server sides. Here is the example.
tokio::spawn(async move {
let app = RateLimitApp;
let service = RateLimitService::new(app);
let service = ServiceBuilder::new()
.rate_limit(5000, std::time::Duration::from_secs(1))
.service(service);
let server = norpc::ServerChannel::new(rx, service);
server.serve().await
});
Regarding 3, you can even define non-Send service to work tasks in a single thread.
#[norpc::service(?Send)]
trait HelloWorld {
fn hello(s: Rc<String>) -> Rc<String>;
}
(updated as of 0.5.1)