A simple and fast contractless RPC library for .NET and .NET Core, over IServiceCollection (you can use any supported DI container)
For .NET 4.6+, NET Standard 2 (.NET Core) available in NuGet
Install-Package SimpleRpc
var sc = new ServiceCollection();
sc.AddSimpleRpcClient("sample", new HttpClientTransportOptions
{
Url = "http://127.0.0.1:5000/rpc"
});
sc.AddSimpleRpcProxy<IFooService>("sample");
// or
sc.AddSimpleRpcProxy(typeof(IFooService), "sample");
var pr = sc.BuildServiceProvider();
var service = pr.GetService<IFooService>();
service.Plus(1,5);In your Startup class...
public void ConfigureServices(IServiceCollection services)
{
services.AddSimpleRpcServer(new HttpServerTransportOptions {Path = "/rpc"});
services.AddSingleton<IFooService, FooServiceImpl>();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseSimpleRpcServer();
}Samples contains examples for using of SimpleRpc
Default serializer can be changed in Serializer property, for example
sc.AddSimpleRpcClient("sample", new HttpClientTransportOptions
{
Url = "http://127.0.0.1:5000/rpc",
Serializer = "wire"
});| Serializer | Name (for client options) |
|---|---|
| MessagePack (lz4 compression) | msgpack |
| Wire (lz4 compression) | wire |