OpenSleigh: a Saga management library for .NET Core
Hi All! Today I want to talk a bit about a pet project of mine I’ve been working on in the last few weeks. I called it OpenSleigh, it’s a Saga management library for .NET Core.
For those who don’t know what the Saga Pattern is, Chris Richardson has a very good introduction on his website.
The basic idea is quite interesting: in a micro-service architecture, it often happens that we need to handle several long-running operations that span multiple services. Distributed transactions are a nasty little beast and we also need a way to keep track of the global status and manage the whole flow.
There are two main schools of thought for this: Choreography and Orchestration.
The core idea behind Choreography is to decentralize the logic. Make it scattered and shared amongst the participants. They usually communicate using a Message Broker, like RabbitMQ or Kafka, which makes it definitely easier to add and remove message publishers and consumers.
With Orchestration instead, a single component handles the logic, and takes care of the entire workflow. Once the process is triggered, this orchestrator will take care of calling each microservice (directly or via messaging) and handling responses and faults.
OpenSleigh falls into the realm of the orchestrators. It can be added to regular Console or Web applications, will spin up a bunch of BackgroundServices, and do its magic.
The Core module of OpenSleigh can be installed from NuGet. However, Transport and Persistence packages are necessary to properly use the library.
These are the packages available at the moment:
Now, there are already several valuable alternatives on the market, like MassTransit and NServiceBus. So why did I started this project?
Because I was curious. And I’m pretty damn sure many of you can relate.
I wanted to see how a Saga system works from the inside. Also, I wondered if I could build one myself from scratch. I wanted to create an open-source project and create a community around it.
So don’t hesitate! Take a look at the repository on GitHub, download the packages, play with them, and send me your feedback!