Orchestration-Based Process Managers (Sagas) in Kalix?

Howdy All,

Hugh McKee, in the excellent video “Kalix Review: How It Works, How To Use It” [1], seems to suggest the use of “Choreography-based Sagas” [2] in Kalix by having Actions that listen for events and send commands to Entities in what he calls cascading events or microstreams.

I’m interested to know how one would suggest implementing stateful “Orchestration-based Saga” [2] in Kalix? Would it be as simple as using a Value or Event-Sourced Entity instead of an Action? That is, a stateful entity that listens for Events and send Commands to other Entities?

Are there any simple but full CQRS examples for Kalix?


[1] Kalix Review – How It Works & How To Use It - YouTube

[2] Sagas

Hi Ashley,

We’re working on a Kalix feature that would enable support for Saga patterns and orchestration.
I’ll be happy to share more details and the ETA with you when we have them.

Thanks and regards,

1 Like

For an orchestration-based saga / process manager, something that can respond to events and send commands (call APIs) is needed. It also needs to be stateful, since orchestration-based process managers are often state machines.

Actions can respond to events and send commands but (AFAIK) they have no easy way to maintain state. This is why they are useful for choreography-based sagas / process managers. Thus they seem to be inappropriate for orchestration.

However, I wonder if we could combine an action with a value entity to create a stateful saga / process manager? The action can respond to events by sending commands to the value entity, which can send commands as needed and maintain its state.

I am new to Kalix and just thinking aloud here… but value any thoughts or suggestions on how best to implement orchestration-based sagas / process managers.


Hey Ashley,

I do believe your thinking is correct and that there are enough building blocks in place to build orchestration-based sagas by using value entities, actions and also some timers. Unfortunately, I don’t know of any very complex example although I think our 3-part blog series on “Implementing Cross-Entity Unique Keys” does a good job discussing some of the aspects and specifically the use of timers for compensating actions.

1 Like

Hi @AshleyAitken

Actually, I could sneak something for you. Here is our answer to orchestration-based Saga - a Workflow Entity Implementing Workflow Entities :: Kalix Documentation It’s not officially released yet, although it’s available in the SDK, check out this sample. Happy to answer if you have any questions.

1 Like