Created
July 28, 2017 06:37
-
-
Save philiplaureano/b42b1a4b6c0a0ab3e39e43927c86509a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Threading.Tasks | |
open Proto | |
open Proto.Mailbox | |
type Actor with | |
static member SpawnFromFunc handler = | |
Actor.FromFunc(fun c-> handler(c)) |> Actor.Spawn | |
[<EntryPoint>] | |
let main argv = | |
let handler = | |
fun (context : IContext) -> | |
match context.Message with | |
| :? string as s -> printfn "%s" s | |
| _ as o -> printfn "Unhandled message type: %s" (o.GetType().Name) | |
Task.CompletedTask | |
let pid = handler |> Actor.SpawnFromFunc | |
pid.Tell("Testing 1 2 3") | |
Console.WriteLine "Press ENTER to continue..." | |
Console.ReadLine() |> ignore | |
0 // return an integer exit code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment