TL;DR:
I have a service that runs fine right now but does not have persistence. I’m a noob to akka and I’m trying to find a good tutorial/example to use to learn how persistence works. The ones I did find from the docs don’t really help. If someone can point me to a sample that is more that can run on it’s on (not just in a unit test) and doesn’t require installing a horde of other technologies that would be great. Even better would be if it includes a mgr/children where the mgr holds actorrefs to the children (similar to the chatroom example without persistence here: Introduction to Actors • Akka Documentation ) that would be even better. I’m working in scala but java docs/examples would still help a lot if there aren’t good scala ones available.
TIA
Long Version:
My current version of my service runs fine but if the server goes down all current state is lost. I need to add persistence. My service basically has job manager actor gets requests with a jobId and if a request is type START it spawns a new child job actor that has a long running process. Any other requests and messages are routed to the child job actor for that jobId. I do this similar to the chat room example ( Introduction to Actors • Akka Documentation ) where the manager has state of a Map jobId → ActorRef. The job actors also have their own state object that would need to be persisted. First off I’m really confused what my “pre-reqs” are besides akka. Do I need akka-cluster and clustersharding? akka-projections? akka-platform? Any direction someone can point to for where I should start would be great.
Some things I’m confused about:
Normally the job manager spawns the jobs and the jobs themselves send messages to other systems during their process and react to the responses (that are routed back to the correct job via jobid) So in trying to understand switching to the Command->Event pattern instead of just a Command, it seems like the restarted job manager replayed events would end up spawning fresh children while the old children would get restarted and the manager would have no references to them. Plus would the replayed events cause the child jobs to resend all the messages to the other systems? Does this mean I need to use Durable state instead of Event Sourcing?
Trying to find the right journal/snapshot plugin to use for the storage I keep seeing much of them marked “deprecated” Is everything moving to using the JDBC plugin?
How does persistence work with timers? I use timers for a number of things (e.g. timeouts waiting for responses for outside systems and scheduled stop time for job)
Thanks!
-Jason
1 post - 1 participant