A simple and fast contractless RPC library for .NET and .NET Core
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
build
sample
src/SimpleRpc
tests/SimpleRpc.Tests
.gitignore
README.md
SimpleRpc.sln
appveyor.yml

README.md

SimpleRpc

Build status License NuGet NuGet

A simple and fast contractless RPC library for .NET and .NET Core, over IServiceCollection (you can use any supported DI container)

Quick Start

For .NET 4.6+, NET Standard 2 (.NET Core) available in NuGet

Install-Package SimpleRpc

Client

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);

Server

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();
}

Sample Projects

Samples contains examples for using of SimpleRpc

Transports

Transport Client options Server options Default serializer
HTTP HttpClientTransportOptions HttpServerTransportOptions MessagePack

Serializers

Default serializer can be changed in any *ClientTransportOptions using the 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