I am looking at akka persistence as a possible platform for a workflow system. The idea is that events are placed on a bus and stateful workflow instances (persistent actors) are created in response.
Users need to interact with any workflows assigned to them, perform updates, reassign them to other users and save the workflow.
Workflows live for days or weeks. My intention is to use
spray.io to expose the workflows via http.
This poses a few problems:
- How do I keep track of workflow instances so they can be retrieved and resumed? My idea is to use a persistent WorkflowTracker actor to create and track live workflows, is this the right approach?
- How would I retrieve only those workflows to which a given user was assigned (or at a certain status, or of a certain type for example)? Ideally I'd like to be able to persist additional state that I could query but I don't see an obvious mechanism for this. I don't really want to have to retrieve all workflows that have ever existed and query them each time a user logs in. I could however implement a read model as per CQRS, storing denormalised state in addition to the persisted actor write model. Are there any obvious known akka techniques or libraries that would help here?
- More generally, combining persistence and FSM (to manage workflow state transitions) feels like a good fit for my use case, is this fully supported? I have seen (possibly out of date) comments suggesting the two traits cannot be mixed.
Many thanks, any advice is much appreciated