SagaFlow 0.1.13
See the version list below for details.
dotnet add package SagaFlow --version 0.1.13
NuGet\Install-Package SagaFlow -Version 0.1.13
<PackageReference Include="SagaFlow" Version="0.1.13" />
paket add SagaFlow --version 0.1.13
#r "nuget: SagaFlow, 0.1.13"
// Install SagaFlow as a Cake Addin #addin nuget:?package=SagaFlow&version=0.1.13 // Install SagaFlow as a Cake Tool #tool nuget:?package=SagaFlow&version=0.1.13
SagaFlow
A framework to quickly scaffold an application based on a declarative message DTO format. Define your messages (commands and/or events) as POCO DTOs, and have a fully functional UI and underlying queue/workflow engine automatically built to handle the messages. You write message classes, plus your business logic within handlers and/or sagas - everything else is generated at runtime.
Message-based Design
The design has been inspired by ServiceStack. Rather than repeat the benefits of a message based design here, please read up on the great docs over at ServiceStack. eg:
- Design message-based APIs
- What is a message-based web service
- Advantages of message-based web services
Getting Started
SagaFlow heavily relies on Rebus under the covers to facilate the messaging and saga/workflow engine. It is worth familiarizing yourself with Rebus and service buses in general.
Define your messages
For example, a command to add a new tenant to your infrastructure:
public record AddTenantCommand
{
public string? Name { get; init; }
}
Implement your logic
Application logic is written inside of message handlers. These are facilitated directly via Rebus - read up more here.
public class AddTenantCommandHandler : IHandleMessages<AddTenantCommand>
{
public Task Handle(AddTenantCommand command)
{
var db = ...;
return db.Tenants.Add(new Tenant { Name = command.Name });
}
}
Resource lists
As well as executing commands, an application almost always needs to display back some lists of resources (often with further commands possible per resource). To achieve this within SagaFlow, implement a resource provider:
public class TenantProvider : IResourceListProvider<Tenant>
{
public Task<IList<Tenant>> GetAll()
{
var db = ...;
return db.Tenants;
}
}
public class Tenant
{
public Guid Id { get; init; }
public string Name { get; init; }
}
Register middleware
SagaFlow relies on installing its own middleware to publish your app schema, serve the UI, serve your app's resources and receive messages. Firstly configure your providers, handlers and the core SagaFlow service (and underlying Rebus service bus):
builder.Services.AddScoped<IResourceListProvider<Tenant>>(s => new TenantProvider());
builder.Services.AddScoped<AddTenantCommandHandler>();
builder.Services.AddSagaFlow(o => o
.AddResourceProvidersFromAssemblyOf<TenantProvider>()
.AddCommandsOfType<AddTenantCommand>()
.WithLogging(l => l.Console())
.WithTransport(t => t.UsePostgreSql(db, "messages", "ops-panel.workflow"))
.WithSubscriptionStorage(s => s.StoreInPostgres(db, "subscriptions", isCentralized: true))
.WithSagaStorage(s => s.StoreInPostgres(db, "saga-data", "saga-index"))
.WithRouting(r => r.TypeBased().MapAssemblyOf<AddTenantCommand>("ops-panel"))
);
Run your app
Your app will serve the generated SagaFlow UI under todo... Insert screenshot of above UI here
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.FileProviders.Embedded (>= 6.0.30)
- NCrontab.Scheduler (>= 1.2.10)
- Rebus (>= 8.2.2)
- Rebus.ServiceProvider (>= 10.1.0)
-
net7.0
- Microsoft.Extensions.FileProviders.Embedded (>= 7.0.19)
- NCrontab.Scheduler (>= 1.2.10)
- Rebus (>= 8.2.2)
- Rebus.ServiceProvider (>= 10.1.0)
-
net8.0
- Microsoft.Extensions.FileProviders.Embedded (>= 8.0.5)
- NCrontab.Scheduler (>= 1.2.10)
- Rebus (>= 8.2.2)
- Rebus.ServiceProvider (>= 10.1.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SagaFlow:
Package | Downloads |
---|---|
SagaFlow.AspNetCore
Package Description |
|
SagaFlow.SignalR
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.35 | 757 | 7/3/2024 |
0.1.34 | 148 | 7/3/2024 |
0.1.33 | 144 | 7/3/2024 |
0.1.32 | 148 | 7/2/2024 |
0.1.31 | 150 | 7/2/2024 |
0.1.30 | 139 | 7/2/2024 |
0.1.29 | 113 | 7/2/2024 |
0.1.28 | 144 | 7/2/2024 |
0.1.27 | 151 | 7/2/2024 |
0.1.26 | 161 | 7/2/2024 |
0.1.25 | 129 | 6/20/2024 |
0.1.24 | 117 | 6/19/2024 |
0.1.23 | 93 | 6/18/2024 |
0.1.22 | 95 | 6/18/2024 |
0.1.21 | 102 | 6/16/2024 |
0.1.20 | 88 | 6/13/2024 |
0.1.19 | 87 | 6/13/2024 |
0.1.18 | 98 | 6/12/2024 |
0.1.14 | 112 | 5/22/2024 |
0.1.13 | 132 | 5/17/2024 |