Uniqueness of persistenceId in akka

I'm using the scala api for akka-persistence to persist a group of actor instances that are organized into a tree. Each node in the tree is a persistent actor and is named based on the path to that node from a 'root' node. The persistenceId is set to the name. For example the root node actor has persistenceId 'root'. The next node down has persistenceId 'root-europe'. Another actor might have persistenceId 'root-europe-italy'.

The state in each actor includes a list of the names of its children. Eg the 'root' actor maintains a list of 'europe', 'asia' etc as part of its state.

I have implemented snapshotting for this system. When the root is triggered to snapshot, it does so and then tells each child to do the same.

The problem arises during snapshot recovery. When I re-create an actor with persistenceId = 'root' (by passing in the name as a constructor parameter), the SnapshotOffer event received by that actor is wrong. It is, for example, 'root-europe-italy....'. This seems like a contradiction of the contract for persistence, where the persistenceId identifies the actor state to be recovered. I got around this problem by reversing the persistenceId of node actors (eg 'italy-europe-root') so this seems to be something related to the way files are retrieved by the persistence module. Note that I tried other approaches first, for example I used a variety of separators between the node names, or no separator at all.

Has anyone else experienced this problem, or can an akka-persistence developer help me understand why this might have happened?

BTW: I am using the built-in file-based snapshot storage for now.

Thanks.


OK - so the issue was with Akka, and has now been resolved. See the related ticket to find out when the patch is released.

链接地址: http://www.djcxy.com/p/62782.html

上一篇: scalatest在intellij 13.1中不起作用

下一篇: 持久性的唯一性在阿卡