Sagas in Akka Serverless?

Hello Everyone,

Very excited to be participating in the Akka Serverless Private Beta to see how well it can be used to implement subsystems using CQRS.

Of course, a lot of the required infrastructure, like event sourcing, is there because it’s how Cloudstate works but other parts are still emerging. I’ve discussed additional Read Models with Leon and the infrastructure needed for those seems to be coming through Google Cloud Pub/Sub.

However, one aspect of CQRS that I can’t seem to figure out is how sagas (aka process managers) would be implemented in Akka Serverless. How can we make a service that responds to events and produce commands, not as we generally do the other way around. Any suggestions? Examples?

Thanks,
Ashley.

2 Likes

Ok, I can see now that Actions (stateless services) can subscribe to events and publish commands.

However, I thought that Sagas are generally stateful, i.e. they need to remember where they are in the process.

So, I guess Sagas needs to be a Service that can subscribe to events and publish commands, sort of a stateful Action?

I have a saga of a sort where an action handles a FundsDeducted event and then completes an order, but this isn’t a true saga because of lack of retry.

I would be good to consider saga for akka serverless, in fact we might even be able to do better, something more ACID-like.

1 Like

One option could be to have a separate, dedicated AkkaServerless service that would facilitate saga (process manager). Service state would be used for saga state/process management. Subscribe and publish (Google PubSub) would be used for communicate between services that require saga pattern.
Thoughts?