Implementing sagas with Kafka

apache-kafka, event-sourcing, saga

Solution

This talk from this year's DDD eXchange is the best resource I came across wrt Process Manager/Saga pattern in event-driven/CQRS systems: https://skillsmatter.com/skillscasts/9853-long-running-processes-in-ddd (requires registering for a free account to view)

The demo shown there lives on github: https://github.com/flowing/flowing-retail

I've given it a spin and I quite like it. I do recommend watching the video first to set the stage.

Although the approach shown is message-bus agnostic, the demo uses Kafka for the Process Manager to send commands to and listen to events from other bounded contexts. It does not use Kafka Streams but I don't see why it couldn't be plugged into a Kafka Streams topology and become part of the broader architecture like the one depicted in the Commander presentation you referenced.

I hope to investigate this further for our own needs, so please feel free to start a thread on the Kafka users mailing list, that's a good place to collaborate on such patterns.

Hope that helps :-)

Problem

I am using Kafka for Event Sourcing and I am interested in implementing sagas using Kafka. Any best practices on how to do this? The Commander pattern mentioned here seems close to the architecture I am trying to build but sagas are not mentioned anywhere in the presentation.

Original source