PersistenceLifecycleEvent not sent to typed actor
See original GitHub issueHi! Is there a way to hook in to PersistenceLifecycleEvent in typed actors? I’ve looked at https://github.com/Horusiath/Akkling/issues/72 and the test, but this seems only to work for untyped actors.
Here is a fork with the same test for a typed actor (Eventsourced<string>), and it currently fails: https://github.com/Yakimych/Akkling/commit/c9dc995e6479f952d2cda973b4c6b2808318b42b
My guess is that typed actors don’t receive messages of anything but the specified type, so I am wondering if this is possible at all.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Classic Persistence - Documentation - Akka
Successfully persisted events are internally sent back to the persistent actor as individual messages that trigger event handler executions.
Read more >How to mock actors in a cluster sharding test environment?
Let's assume persistent actor/event sourced behavior of type EntityA will create and interact with another persistent actor/event sourced ...
Read more >Persistence failure when replaying events for persistenceId ...
Akka.Cluster.Sharding.PersistentShardCoordinator throws exception when replaying the events. It can connect to the database and create all ...
Read more >Viewing Akka Persistence data stored in Cassandra (Part 2)
When the actor is restarted, in the initialization process, receiveRecover will be called repeatedly with the events.² With each event the state ...
Read more >Event Sourcing · Apache Pekko Documentation
An event sourced actor (also known as a persistent actor) receives a (non-persistent) command which is first validated if it can be applied...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think the reason here is that your persistence provider uses some configuration of JSON.NET, that doesn’t support type name handling. There are two problems:
serializer.DeserializeObject<obj>is called.Usually when it comes to persistent serialization, I suggest people to write their own custom serializers (using eg. protobuf, FsPickler or whatever you want), to have full control of binary format and how it changes over time.
From what I see, you’re using Json.NET for persistence - this may be the reason, when trying to deserialize json payload into
objit doesn’t know what specific type of object do you want - which in this case it will default toJDocumentorJObject.This is continuous problem of using JSON.NET, and one of the reasons why we started using Hyperion - but problem with Hyperion is that it’s binary format is not stabilized and it doesn’t provide any guarantees, that future version will keep it backwards compatible.