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?

Cheers,
Ashley.

[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,
Rahul

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.

Cheers,
Ashley.

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

@aludwiko Will Workflows be available for the “Java/Scala Protobuf” SDK as well?

Yes, but to answer when, I will summon @rahul

1 Like

Hey @rahul , any updates on the awesome Workflow feature?

Hi @glop.postbox.0u

We are currently discussing Workflows support in Java/Scala Protobuf SDKs and my best guess would be in the next 3-4 months but I don’t have a definitive answer atm.

:+1: Can’t wait :+1:

For the record, note that Workflows are now available for protocol-first sdks since v1.4.0. See docs here.

1 Like