forked from OrleansContrib/Orleankka
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.fs
More file actions
47 lines (35 loc) · 1.14 KB
/
Program.fs
File metadata and controls
47 lines (35 loc) · 1.14 KB
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
open System
open System.Reflection
open Orleankka
open Orleankka.FSharp
open Orleankka.Playground
type Message =
| Greet of string
| Hi
interface ActorMessage<Greeter>
and Greeter() =
inherit Actor<Message>()
override this.Receive message = task {
match message with
| Greet who -> printfn "Hello %s" who
return response()
| Hi -> printfn "Hello from F#!"
return response()
}
[<EntryPoint>]
let main argv =
printfn "Running demo. Booting cluster might take some time ...\n"
use system = ActorSystem.Configure()
.Playground()
.Register(Assembly.GetExecutingAssembly())
.Done()
let actor = system.TypedActorOf<Greeter>(Guid.NewGuid().ToString())
let job() = task {
do! actor <! Hi
do! actor <! Greet "Yevhen"
do! actor <! Greet "AntyaDev"
//do! actor <! true won't compile
}
Task.run(job) |> ignore
Console.ReadLine() |> ignore
0