Reputation: 11
I am developing an application using AKKA
(Java API).
I have a few questions:
In an actor class, is it okay to have a few data structures (Example: HashMap) as part of the actor state (attributes of the class)?
If the actor dies, actor will be restarted by the SUpervisory actor. However, I am wondering how to restore the contents of these data structures. Please suggest?
Initially, I thought of using Cassandra
to persist the data as and when this actor receives messages to save the member objects to Cassandra
. Not sure if this is the right approach.
Please help
Thank you, KS
Upvotes: 1
Views: 892
Reputation: 8473
One possible option is keep it in data related to actors in Redis similar to how you can create a durable mailbox. In what situation is your actor dying?
Upvotes: 0
Reputation: 26579
Have a child actor that performs any and all risky operations, and have your actor's supervisor strategy set up to fit your needs for that child.
Upvotes: 2