控制台程序

1
2
PM> install-package Akka
PM> install-package Akka.Remote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using Akka;
using Akka.Actor;
using Akka.Configuration;
namespace Foo.Bar
{
class Program
{
static void Main(string[] args)
{
//配置远程路径为 localhost:8081
var fluentConfig = FluentConfig.Begin()
.StartRemotingOn("localhost", 8081)
.Build();
using (var system = ActorSystem.Create("my-actor-server", fluentConfig))
{
//实例化两个服务
var service1= system.ActorOf<Service1>("service1");
var service2 = system.ActorOf<Service2>("service2");
Console.ReadKey();
}
}
}
}