Skip to content

pipe01/RabbitRPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RabbitRPC

nuget

An RPC library that leverages RabbitMQ

Usage

Classic style

"Publisher" service:

public class MyService : RpcService
{
    public virtual int Multiply(int n, int f)
    {
        return n * f;
    }
}

IModel channel = /* usual rabbit channel creation */

var svc = new MyService();
svc.BindTo(channel, "MyService");
//or
svc.BindTo(channel); //In this case the queue name will default to the class' full name

"Consumer" service:

using var caller = new RpcCaller(channel, "MyService");

int result = await caller.Call("Multiply", 2, 5);
Assert.Equal(result, 10);

Proxy style

Same publisher as before, but the consumer is slightly different:

using var caller = new RpcCaller(channel, "MyService");
MyService svc = caller.CreateProxy<MyService>();

int result = svc.Multiply(2, 5);
Assert.Equal(result, 10);

Releases

No releases published

Packages

No packages published

Languages