Skip to content

andersarpi/protoactor-dotnet

 
 

Repository files navigation

Build status

Join the chat at https://gitter.im/AsynkronIT/protoactor

Proto.Actor

Ultra fast distributed actors for .NET and Go

Sourcecode - C#

This is the .NET repository for Proto Actor.

The Go implementation can be found here https://github.com/AsynkronIT/protoactor-go

Design principles:

Minimalistic API - The API should be small and easy to use. Avoid enterprisey JVM like containers and configurations.

Build on existing technologies - There are already a lot of great tech for e.g. networking and clustering, build on those. e.g. gRPC streams for networking, Consul.IO for clustering.

Pass data, not objects - Serialization is an explicit concern, don't try to hide it. Protobuf all the way.

Be fast - Do not trade performance for magic API trickery.

Hello world

Define a message type:

internal class Hello
{
    public string Who;
}

Define an actor:

internal class HelloActor : IActor
{
    public Task ReceiveAsync(IContext context)
    {
        var msg = context.Message;
        if (msg is Hello r)
        {
            Console.WriteLine($"Hello {r.Who}");
        }
        return Actor.Done;
    }
}

Spawn it and send a message to it:

var props = Actor.FromProducer(() => new HelloActor());
var pid = Actor.Spawn(props);
pid.Tell(new Hello
{
    Who = "Alex"
});

For more examples, see the examples folder in this repository.

NuGet

PM> Install-Package Proto.Actor

About

Proto Actor - Ultra fast distributed actors for Golang and C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 95.5%
  • PowerShell 2.5%
  • Shell 1.2%
  • Other 0.8%