Hello all!
I have to create the simple workflow execution engine, that supports timeouts in its states. The sample made-up definition and the sequence of the states could be as following:
1) Send the confirmation e-mail to the customer once
2) Await the confirmation event for 24 hours
3) If there is a timeout error - then send another e-mail to the customer with the reminder and wait for 48 hours
4) If there is the confirmation event - then complete the registration and send welcome e-mail
5) if there's another timeout from step 3 - then cancel the registration process and cleanup the database
I think that I could easily create 10K-100K of instances of the actors in the JVM - actors seems to be cheap, however I'm not sure
- how the timeouts for the states will be processed, could I jam into some bottleneck with the scheduled events processing? What is the recommended thread pool size for 10K of actors, ballpark value?
- how do I persist the states of the workflow actors and recover them with the correct timeouts, if for some reason actor dies on step 2 after 10 hours of waiting, and upon the restart I need to adjust the timeout to be not 24 hours, but 14 hours. I know that I can start FSM with any state and state data, perhaps I could also set the custom step timeout upon init of the FSM.
I think that I could create some sort of the database that may keep the state and state data of each of workflows actor, but may be I am reinventing the wheel and there's already some akka-scheduler contrib module I overlooked?
Thanks in advance!