Skip to content
yfakariya edited this page May 27, 2012 · 2 revisions

MessagePack is interoperable binary encoding format. MessagePack RPC is interoperable RPC framework using MessagePack, and supports asynchronous communication.

Usage

Client

It's simple. Create, do, done.

There are only 3 steps.

  1. Create an RpcClientConfiguration instance. Optionally you can tweak it.
  2. Create DynamicRpcProxy with target EndPoint and configuration and treat it as dynamic object.
  3. Call service method to the dynamic object.

A small sample is here:

[C#]

var configuration = new RpcClientConfiguration();
// Tweak configuration here...
using ( dynamic proxy = DynamicRpcProxy.Create( new DnsEndPoint( "example.com", 19860 ), configuration ) )
{
    proxy.Foo(...); // Dynamic dispatch!
}

[Visual Basic]

Dim configuration = New RpcClientConfiguration()
' Tweak configuration here...
Using ( Dim proxy As Object = DynamicRpcProxy.Create( New DnsEndPoint( "example.com", 19860 ), configuration ) )
    proxy.Foo(...) ' Dynamic dispatch!
End Using

Server

It is bit more complex than client, but quite simple.

There are only 5 steps.

  1. Deploy assemblies which implements service in the current directory.
  2. Create an RpcServerConfiguration instance. Optionally you can tweak it.
  3. Create an RpcServer which host all transports with configuration.
  4. Invoke RpcServer.Start() to start listening.
  5. Block current thread (invoke Console.ReadLine() for naive example) to server will not exit immediately.

A small sample is here:

[C#]

var configuration = new RpcServerConfiguration();
// Tweak configuration here...
using ( var server = new RpcServer( configuration ) )
{
    server.Start();
    Console.ReadKey();
}

[Visual Basic]

Dim configuration = New RpcServerConfiguration()
' Tweak configuration here...
Using ( Dim server = New RpcServer( configuration ) )
    server.Start()
    Console.ReadKey()
End Using