forked from OrleansContrib/Orleankka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.fs
44 lines (32 loc) · 1 KB
/
Program.fs
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
open System
open System.Reflection
open Orleankka.FSharp
open Orleankka.FSharp.Configuration
open Orleankka.FSharp.Runtime
type Message =
| Greet of string
| Hi
type Greeter() =
inherit Actor<Message>()
override this.Receive message = task {
match message with
| Greet who -> printfn "Hello %s" who
return nothing
| Hi -> printfn "Hello from F#!"
return nothing
}
[<EntryPoint>]
let main argv =
printfn "Running demo. Booting cluster might take some time ...\n"
use system = [|Assembly.GetExecutingAssembly()|]
|> ActorSystem.createPlayground
|> ActorSystem.start
let actor = ActorSystem.actorOf<Greeter>(system, "actor_id")
let job() = task {
do! actor <! Hi
do! actor <! Greet "Yevhen"
do! actor <! Greet "AntyaDev"
}
Task.run(job) |> ignore
Console.ReadLine() |> ignore
0