Skip to content

Instantly share code, notes, and snippets.

@codingedgar
Last active September 18, 2020 14:46
Show Gist options
  • Save codingedgar/99326cf166e57ba97258ad0eaa36025f to your computer and use it in GitHub Desktop.
Save codingedgar/99326cf166e57ba97258ad0eaa36025f to your computer and use it in GitHub Desktop.
f# akka.net akkling minimal config
#r "packages/Hyperion/lib/netstandard2.0/Hyperion.dll"
#r "packages/Newtonsoft.Json/lib/netstandard2.0/Newtonsoft.Json.dll"
#r "packages/Akka.Serialization.Hyperion/lib/netstandard2.0/Akka.Serialization.Hyperion.dll"
#r "packages/Akka/lib/netstandard2.0/Akka.dll"
#r "packages/Akkling/lib/netstandard2.0/Akkling.dll"
open System
open Akka
open Akkling
type Command = | Path
let buildCommonActor =
props (fun context ->
let rec loop () =
actor {
let! command = context.Receive()
match command with
| Path ->
context.Sender()
<! context.Self.Path.ToStringWithAddress()
return! loop ()
}
loop ())
let system =
System.create "OurApp" (Configuration.defaultConfig ())
let commonActor =
buildCommonActor |> spawn system "common_actor"
commonActor
<? Path
|> Async.RunSynchronously
|> printfn "actor response: %A" // actor response: "akka://OurApp/user/common_actor"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment