protoactor-dotnet

Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin

Github星跟蹤圖

Build status

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

Proto.Actor

Ultra-fast, distributed, cross-platform actors.

Installing

Using NuGet Package Manager Console:
PM> Install-Package Proto.Actor

Source code

This is the .NET repository for Proto Actor.

Other implementations:

How to build

Proto.Actor uses and requires the VS2017 build system in order to build. You can either use the dotnet CLI commands, or use Visual Studio 2017.

We also use Cake for orchestrating the CI builds. The CI build basically runs dotnet restore, dotnet build, dotnet test and dotnet pack. To run a full CI build execute either .\build.ps1 or ./build.sh, depending on your environment.

Design principles

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

Build on existing technologies - There are already a lot of great technologies for e.g. networking and clustering. Build on those instead of reinventing them. E.g. gRPC streams for networking, Consul 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.

Getting started

The best place currently for learning how to use Proto.Actor is the examples. Documentation and guidance is under way, but not yet complete, and can be found on the website.

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 context = new RootContext();
var props = Props.FromProducer(() => new HelloActor());
var pid = context.Spawn(props);

context.Send(pid, new Hello
{
    Who = "Alex"
});

You should see the output Hello Alex.

Support

Many thanks to JetBrains for support!

主要指標

概覽
名稱與所有者asynkron/protoactor-dotnet
主編程語言C#
編程語言C# (語言數: 6)
平台
許可證Apache License 2.0
所有者活动
創建於2017-01-01 16:13:35
推送於2025-04-01 18:16:53
最后一次提交
發布數40
最新版本名稱1.7.0 (發布於 )
第一版名稱0.2.0 (發布於 )
用户参与
星數1.8k
關注者數96
派生數290
提交數2.5k
已啟用問題?
問題數462
打開的問題數85
拉請求數1175
打開的拉請求數22
關閉的拉請求數492
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?