Skip to content

Instantly share code, notes, and snippets.

@Horusiath
Last active May 30, 2022 13:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Horusiath/ba2e5b33dc4377a0f018 to your computer and use it in GitHub Desktop.
Save Horusiath/ba2e5b33dc4377a0f018 to your computer and use it in GitHub Desktop.
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 ()
}
loop ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment