-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
31 lines (22 loc) · 818 Bytes
/
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
using HelloWorld;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
// Configure the host
using var host = new HostBuilder()
.UseOrleans(builder => builder.UseLocalhostClustering())
.Build();
// Start the host
await host.StartAsync();
// Get the grain factory
var grainFactory = host.Services.GetRequiredService<IGrainFactory>();
// Get a reference to the HelloGrain grain with the key "friend"
var friend = grainFactory.GetGrain<IHelloGrain>("friend");
// Call the grain and print the result to the console
var result = await friend.SayHello("Good morning!");
Console.WriteLine($"""
{result}
""");
Console.WriteLine("Orleans is running.\nPress Enter to terminate...");
Console.ReadLine();
Console.WriteLine("Orleans is stopping...");
await host.StopAsync();