OpenSleigh: A Saga Management Library for .NET Core
This article provides the latest news on OpenSleigh, a distributed saga management library written in C# with .NET Core 5.
Join the DZone community and get the full member experience.
Join For FreeHi 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 call it OpenSleigh, and 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.
With Choreography, the logic is decentralized, scattered, and shared amongst the participants. They usually communicate using a Message Broker, like RabbitMQ or Kafka, which makes definitely easier to add and removing message publishers and consumers.
With Orchestration, instead, the logic is centralized in a single component, which is in charge 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?
I was curious, and I’m pretty 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!
Opinions expressed by DZone contributors are their own.
Comments