-
Notifications
You must be signed in to change notification settings - Fork 77
/
Program.cs
56 lines (45 loc) · 1.5 KB
/
Program.cs
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Orleankka.Cluster;
using Orleans.Hosting;
using Orleans.Runtime;
using Orleans.Storage;
namespace ProcessManager
{
using Orleankka;
using Orleankka.Client;
public static class Program
{
static IHost host;
public static async Task<int> Main()
{
var system = await RunCluster();
RunGui(system);
return 0;
}
static async Task<IClientActorSystem> RunCluster()
{
var folder = Storage.Init();
host = await SiloHostBuilderExtension.UseOrleankka(new HostBuilder()
.ConfigureServices(s => s
.AddKeyedSingleton<IGrainStorage>("copier", (sp, __) => new Storage(sp, typeof(CopierState), folder)))
.UseOrleans(c => c
.AddMemoryStreams("notifications")))
.StartServer();
return SiloHostBuilderExtension.ActorSystem(host);
}
static void RunGui(IClientActorSystem system)
{
Host.CreateDefaultBuilder()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureServices(x => x.AddSingleton(system));
webBuilder.UseStartup<Startup>();
})
.Build()
.Run();
}
}
}