akka persistence for long running workflows

149 views
Skip to first unread message

io loop

unread,
Dec 8, 2014, 6:50:41 PM12/8/14
to akka...@googlegroups.com
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

Martynas Mickevičius

unread,
Dec 18, 2014, 8:22:59 AM12/18/14
to akka...@googlegroups.com
On Tue, Dec 9, 2014 at 1:50 AM, io loop <iol...@gmail.com> wrote:
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?

I think in the same vein as WorkflowTracker you could have persistent User actors which would persist work assignments and deassignments.
 

- 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.

There is an ongoing effort to provide FSM for persistent actors. Check the PR for discussion. 
 

Many thanks, any advice is much appreciated

--
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


--
Martynas Mickevičius
TypesafeReactive Apps on the JVM
Reply all
Reply to author
Forward
0 new messages