gitmyhub

workflow-core

C# ★ 5.9k updated 1mo ago

Lightweight workflow engine for .NET Standard

Workflow Core is a .NET library for defining and running long-running multi-step processes in C#, with state saved to a database so work is not lost if the app restarts, plus automatic rollback on failure.

C#.NETSQL ServerPostgreSQLMongoDBRedisSQLitesetup: moderatecomplexity 3/5

Workflow Core is a library for .NET applications that helps developers describe and run multi-step processes that can take a long time to complete. Instead of writing custom logic to track what step a process is on, or what to do if a step fails, you define the steps once and the library handles the rest, including saving state between steps so work is not lost if the application restarts.

You can describe a workflow in C# code using a fluent style where each step follows the previous one, or you can write the definition in JSON or YAML if you want to keep the process description separate from the application code. A workflow can run tasks in sequence, in parallel, loop over items, wait for an external event before continuing, or branch based on the outcome of a step.

One notable feature is saga support. A saga is a pattern for handling situations where several steps need to succeed as a group: if one step fails, the library can automatically run compensating actions to undo the earlier steps. This is useful for things like creating an account across multiple services, where a partial failure would leave data in an inconsistent state.

Workflow Core is designed to be embedded in a .NET application rather than run as a separate service. It stores workflow state in a database you provide, with official support for SQL Server, PostgreSQL, SQLite, MongoDB, MySQL, Redis, and several cloud databases. A related project called Conductor wraps the same engine in a standalone HTTP server for those who prefer that approach. The library also has ports for Java, Node.js, and Python listed in the repository.

Where it fits