Skip to content

Instantly share code, notes, and snippets.

@Horusiath
Horusiath / example.fs
Last active May 30, 2022 13:03
Akka.NET F# API PreStart and PostStop handling
let aref =
spawn system "actor"
<| fun mailbox ->
printf "pre-start" // this section works like pre-start
mailbox.Defer (fun () -> printf "post-stop") // this registers a function to be called on PostStop
let rec loop () =
actor {
let! msg = mailbox.Receive ()
// do some work
return! loop ()