FSharp.Actor
An actor framework for F#.
From an example:
let rec schizoPing =
(fun (actor:IActor<_>) ->
let log = (actor :?> Actor.T<_>).Log
let rec ping() =
async {
let! (msg,_) = actor.Receive()
log.Info(sprintf "(%A): %A ping" actor msg, None)
return! pong()
}
and pong() =
async {
let! (msg,_) = actor.Receive()
log.Info(sprintf "(%A): %A pong" actor msg, None)
return! ping()
}
ping()
)
Sending two messages to the 'schizo' actor results in
let schizo = Actor.spawn (Actor.Options.Create("schizo")) schizoPing
!!"schizo" <-- "Hello"
!!"schizo" <-- "Hello"
Output:
(schizo): "Hello" ping
(schizo): "Hello" pong
Find it at github and at docs