You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Persistent actors don't receive PersistentLifecycleEvent. They receive Akka.Persistence.RecoveryCompleted directly. This can be verified by running this script:
#r "../src/Akkling/bin/Debug/Akka.dll"
#r "../src/Akkling/bin/Debug/Hyperion.dll"
#r "../src/Akkling/bin/Debug/Newtonsoft.Json.dll"
#r "../src/Akkling/bin/Debug/FSharp.PowerPack.dll"
#r "../src/Akkling/bin/Debug/FSharp.PowerPack.Linq.dll"
#r "../src/Akkling/bin/Debug/Akkling.dll"
#r "../src/Akkling/bin/Debug/System.Collections.Immutable.dll"
#r "../src/Akkling.Persistence/bin/Debug/Google.Protobuf.dll"
#r "../src/Akkling.Persistence/bin/Debug/Akka.Persistence.dll"
#r "../src/Akkling.Persistence/bin/Debug/Akkling.Persistence.dll"
open System
open Akkling
open Akkling.Persistence
let system = System.create "persisting-sys" <| Configuration.defaultConfig()
type CounterChanged =
{ Delta : int }
type CounterCommand =
| Inc
| Dec
| GetState
type CounterMessage =
| Command of CounterCommand
| Event of CounterChanged
let actor (mailbox:Eventsourced<_>) =
let rec loop state =
actor {
let! (msg : obj) = mailbox.Receive()
match msg with
| :? CounterMessage as cm ->
match cm with
| Event(changed) -> return! loop (state + changed.Delta)
| Command(cmd) ->
match cmd with
| GetState ->
mailbox.Sender() <! state
return! loop state
| Inc -> return Persist <| box (Event { Delta = 1 })
| Dec -> return Persist <| box (Event { Delta = -1 })
| :? LifecycleEvent as x -> printfn "Lifecycle %A" x; return! loop state
| :? PersistentLifecycleEvent as x -> printfn "Persistence Lifecycle %A" x; return! loop state
| x -> printfn "Catch all %A" x; return! loop state
}
loop 0
let counter : IActorRef<CounterMessage> = spawn system "counter-1" <| propsPersist actor |> retype
which results with
Lifecycle PreStart
Catch all Akka.Persistence.RecoveryCompleted
The text was updated successfully, but these errors were encountered:
Persistent actors don't receive
PersistentLifecycleEvent
. They receiveAkka.Persistence.RecoveryCompleted
directly. This can be verified by running this script:which results with
The text was updated successfully, but these errors were encountered: