-
Notifications
You must be signed in to change notification settings - Fork 15
Quick start
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.
It's simple. Create, do, done.
There are only 3 steps.
- Create an
RpcClientConfiguration
instance. Optionally you can tweak it. - Create
DynamicRpcProxy
with targetEndPoint
and configuration and treat it as dynamic object. - 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
It is bit more complex than client, but quite simple.
There are only 5 steps.
- Deploy assemblies which implements service in the current directory.
- Create an
RpcServerConfiguration
instance. Optionally you can tweak it. - Create an
RpcServer
which host all transports with configuration. - Invoke
RpcServer.Start()
to start listening. - 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