Cratis.Orleans
1.27.2
Prefix Reserved
dotnet add package Cratis.Orleans --version 1.27.2
NuGet\Install-Package Cratis.Orleans -Version 1.27.2
<PackageReference Include="Cratis.Orleans" Version="1.27.2" />
<PackageVersion Include="Cratis.Orleans" Version="1.27.2" />
<PackageReference Include="Cratis.Orleans" />
paket add Cratis.Orleans --version 1.27.2
#r "nuget: Cratis.Orleans, 1.27.2"
#:package Cratis.Orleans@1.27.2
#addin nuget:?package=Cratis.Orleans&version=1.27.2
#tool nuget:?package=Cratis.Orleans&version=1.27.2
<div align="center"> <a href="https://www.cratis.io"> <img src="full-logo.png" alt="Cratis Orleans" width="480"> </a>
<h3 align="center">Cratis Orleans</h3>
<p align="center"> Cratis Orleans is a set of building blocks for .NET developers that provides durable jobs, pluggable jobs storage, and silo hosting. <br /> <a href="https://www.cratis.io/orleans/"><strong>Explore the docs »</strong></a> <br /> <br /> <a href="#-getting-started">Getting Started</a> · <a href="https://github.com/cratis/Orleans/issues/new?labels=bug">Report a Bug</a> · <a href="https://github.com/cratis/Orleans/issues/new?labels=enhancement">Request a Feature</a> · <a href="https://discord.gg/kt4AMpV8WV">Join the Discord</a> </p>
<p align="center"> <a href="https://discord.gg/kt4AMpV8WV"> <img src="https://img.shields.io/discord/1182595891576717413?label=Discord&logo=discord&color=7289da" alt="Discord"> </a> <a href="http://nuget.org/packages/cratis.orleans"> <img src="https://img.shields.io/nuget/v/Cratis.Orleans?logo=nuget" alt="NuGet"> </a> <a href="https://github.com/Cratis/Orleans/actions/workflows/dotnet-build.yml"> <img src="https://github.com/Cratis/Orleans/actions/workflows/dotnet-build.yml/badge.svg" alt=".NET Build"> </a> <a href="https://github.com/Cratis/Orleans/actions/workflows/publish.yml"> <img src="https://github.com/Cratis/Orleans/actions/workflows/publish.yml/badge.svg" alt="Publish"> </a> <a href="./LICENSE"> <img src="https://img.shields.io/badge/license-MIT-blue" alt="License"> </a> </p> </div>
Cratis Orleans holds the Orleans building blocks every Cratis service needs: a durable job system for work that outlives a request, a storage API the job state persists through — with MongoDB, SQL and in-memory providers — and the silo hosting tooling that co-hosts Orleans next to an application in one call.
It is consolidated here from Chronicle (the job engine, the workers pattern, the serializers), Direct (the hosting knowledge) and Studio (the package-alignment guard) — so all three consume one canonical implementation instead of three diverging copies. The repository has no dependency on Chronicle; Chronicle is a consumer, like every other Cratis service.
For core values and principles, read our core values and principles.
✨ Key Features
⚙️ Job System
| Durable Jobs | Work that outlives a request — replay, migration, provisioning — persisted through the storage API and rehydrated when the silo restarts |
| Steps as Grains | Each step is its own Orleans grain, so slow or hanging steps never stall each other and run in parallel, bounded by a throttle |
| Plan then Perform | PrepareSteps says what will happen before any of it happens — watchable progress rather than a spinner |
| At-least-once | A step in flight when the host went down is performed again on resume; progress checkpoints are debounced and time-flushed |
| Fail-open | One failed step fails the job's completion status — never the application; the history says which step was which |
| Lifecycle Control | Stop, resume and delete through the jobs manager grain, or the client-facing commands consumers build on it |
🗄️ Pluggable Storage
| Scope + Namespace Seam | IJobsStorage.GetFor(scope, namespace) — opaque values every consumer maps its identity onto (Chronicle: event store and namespace; an application: tenant or service) |
| MongoDB Provider | Polymorphic request BSON serialization, indexes on status and type, conventions, configurable database naming |
| SQL Provider | EF Core — SQL Server, PostgreSQL, SQLite — with full provider and connection flexibility per scope |
| In-memory Provider | For spec hosts and services that do not need jobs to survive a restart |
🖥️ Silo Hosting
| One Call | AddCratisOrleans brings the whole job system: grains, storage providers, serializers, type discovery, throttle and options |
| Clustering | Localhost for development, durable MongoDB membership for running more than one instance |
| Reminder Safety | The 9.x MongoDB provider's reminder table hangs the 10.x reminder service — the hosting keeps reminders on the in-memory service and the knowledge lives here once |
| Alignment Guard | Cratis.Orleans depends directly on Orleans 10 Reminders for .NET 8, 9 and 10, so the MongoDB provider's Orleans 9 dependency cannot split a consumer's graph. The buildTransitive target also fails Release builds if Reminders drifts from Server. |
🔧 Building Blocks
| Workers | The background-task pattern the job steps run through — also usable directly |
| Typed Grain Keys | KeyHelper combines and parses compound grain keys (scope#namespace) |
| Cratis Serializers | Orleans codecs for concepts (ConceptAs<T>), OneOf, expando objects and LINQ collections, plus a JSON fallback carrying the job state converter |
| Public Logging Surface | BeginJobScope/BeginJobStepScope and the [LoggerMessage] partials a consumer's own jobs read through |
📦 Packages
| Package | What it holds |
|---|---|
Cratis.Orleans |
The job engine, Workers, typed grain keys, serializers, silo hosting |
Cratis.Orleans.Storage |
The jobs storage API, the scope resolver, the in-memory provider |
Cratis.Orleans.Storage.MongoDB |
The MongoDB storage provider |
Cratis.Orleans.Storage.Sql |
The SQL storage provider (EF Core; net10, matching EF Core 10) |
🚀 Getting Started
You need the .NET 10 SDK and, for anything but the in-memory storage, a MongoDB server.
dotnet add package Cratis.Orleans
dotnet add package Cratis.Orleans.Storage.MongoDB
using Cratis.Orleans.Hosting;
using Cratis.Orleans.Setup;
using MongoDB.Driver;
var builder = WebApplication.CreateBuilder(args);
builder.AddCratisOrleans(new CratisOrleansOptions
{
ClusterId = "my-service",
ServiceId = "my-service"
});
builder.Services.AddCratisOrleansMongoDBJobsStorage(
new MongoClient("mongodb://localhost:27017"));
var app = builder.Build();
app.Run();
Define a job and its steps — grains, discovered automatically, nothing to register:
public record ProvisionTenant(string TenantId, string[] Features) : IJobRequest;
public interface IProvisionTenant : IJob<ProvisionTenant>;
public class ProvisionTenantJob : Job<ProvisionTenant, JobState>, IProvisionTenant
{
// Completed jobs remove themselves by default; keep this one queryable.
protected override bool KeepAfterCompleted => true;
protected override Task<IImmutableList<JobStepDetails>> PrepareSteps(ProvisionTenant request) =>
Task.FromResult<IImmutableList<JobStepDetails>>(
request.Features.Select(feature => new JobStepDetails(
Type: typeof(IProvisionFeatureStep),
Id: JobStepId.New(),
Key: new JobStepKey(JobId, string.Empty, string.Empty),
Request: feature,
ResultType: typeof(string))).ToImmutableList());
}
Start it through the jobs manager — the two strings are the storage scope and namespace:
var manager = grainFactory.GetJobsManager("my-service", string.Empty);
var result = await manager.Start<IProvisionTenant, ProvisionTenant>(new(id, ["billing"]));
Starting returns as soon as the job exists. Stop the service mid-flight and start it again — the job picks itself back up. That is the point.
Read the full walkthrough in the getting-started guide.
🧪 Testing
The repository carries three spec tiers:
- Unit specs (
Source/*/.Specs) — 76+ Orleans TestKit specs covering the job grain lifecycle, the throttle, the checkpoint debouncer, the serializers and the storage scope resolution. - Integration specs (
Integration/Jobs.Integration) — end-to-end against a real co-hosted silo and a real MongoDB: start a job, run its steps as real grains, persist the state. CI runs a MongoDB service container so these gate every pull request. - Consumer suites — Chronicle's kernel spec suite (3,496 specs) runs against the package engine through its rip-out integration.
🤝 Support
Cratis is an open community, and we are glad to help users, teams evaluating the stack, and contributors.
| Channel | Details |
|---|---|
| Discord | Join the community on Discord for questions and discussions |
| GitHub Issues | Report bugs or request features |
| Documentation | Read the docs at cratis.io/orleans |
👷 Contributing
If you want to jump into building this repository and possibly contributing, refer to contributing.
Prerequisites
- .NET 10 SDK
- Docker — the integration specs and the MongoDB spec suites run against containers
Build and test
dotnet build
dotnet test
The integration specs expect a MongoDB on localhost:27017 (or a running Docker daemon).
📄 License
Cratis Orleans is free software distributed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Cratis.Fundamentals (>= 7.25.1)
- Cratis.Orleans.Storage (>= 1.27.2)
- Microsoft.Orleans.Core.Abstractions (>= 10.4.0)
- Microsoft.Orleans.Reminders (>= 10.4.0)
- Microsoft.Orleans.Sdk (>= 10.4.0)
- Microsoft.Orleans.Serialization (>= 10.4.0)
- Microsoft.Orleans.Serialization.SystemTextJson (>= 10.4.0)
- Microsoft.Orleans.Server (>= 10.4.0)
- OneOf (>= 3.0.271)
- Orleans.Providers.MongoDB (>= 9.5.0)
- SharpCompress (>= 0.50.7)
- Snappier (>= 1.3.1)
- System.Reactive (>= 7.0.0)
-
net8.0
- Cratis.Fundamentals (>= 7.25.1)
- Cratis.Orleans.Storage (>= 1.27.2)
- Microsoft.Orleans.Core.Abstractions (>= 10.4.0)
- Microsoft.Orleans.Reminders (>= 10.4.0)
- Microsoft.Orleans.Sdk (>= 10.4.0)
- Microsoft.Orleans.Serialization (>= 10.4.0)
- Microsoft.Orleans.Serialization.SystemTextJson (>= 10.4.0)
- Microsoft.Orleans.Server (>= 10.4.0)
- OneOf (>= 3.0.271)
- Orleans.Providers.MongoDB (>= 9.5.0)
- SharpCompress (>= 0.50.7)
- Snappier (>= 1.3.1)
- System.Reactive (>= 7.0.0)
- System.Text.Json (>= 9.0.13)
-
net9.0
- Cratis.Fundamentals (>= 7.25.1)
- Cratis.Orleans.Storage (>= 1.27.2)
- Microsoft.Orleans.Core.Abstractions (>= 10.4.0)
- Microsoft.Orleans.Reminders (>= 10.4.0)
- Microsoft.Orleans.Sdk (>= 10.4.0)
- Microsoft.Orleans.Serialization (>= 10.4.0)
- Microsoft.Orleans.Serialization.SystemTextJson (>= 10.4.0)
- Microsoft.Orleans.Server (>= 10.4.0)
- OneOf (>= 3.0.271)
- Orleans.Providers.MongoDB (>= 9.5.0)
- SharpCompress (>= 0.50.7)
- Snappier (>= 1.3.1)
- System.Reactive (>= 7.0.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Cratis.Orleans:
| Package | Downloads |
|---|---|
|
Cratis.Chronicle.Testing
Testing helpers for Cratis Chronicle - the open-source (MIT) event-sourcing database and runtime. In-process kernel and in-memory storage for testing event-sourced applications. |
|
|
Cratis.Chronicle.XUnit.Integration
xUnit integration-testing support for Cratis Chronicle - the open-source (MIT) event-sourcing database and runtime. Fixtures and helpers for integration tests against an in-process kernel. |
|
|
Cratis.Orleans.Storage.MongoDB
MongoDB storage provider for the Cratis.Orleans job system |
|
|
Cratis.Orleans.Storage.Sql
SQL storage provider (EF Core: SQL Server, PostgreSQL, SQLite) for the Cratis.Orleans job system |
|
|
Cratis.Orleans.Chronicle
Chronicle integration for Cratis Orleans - event-sourced state machines whose model is a Chronicle read model and whose transitions are driven by Chronicle events |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.27.2 | 0 | 10/20/2026 |
| 1.27.1 | 103 | 10/19/2026 |
| 1.27.0 | 65 | 10/19/2026 |
| 1.26.0 | 63 | 10/19/2026 |
| 1.25.0 | 1,739 | 10/18/2026 |
| 1.24.3 | 67 | 10/18/2026 |
| 1.24.2 | 433 | 10/18/2026 |
| 1.24.1 | 61 | 10/18/2026 |
| 1.24.0 | 70 | 10/18/2026 |
| 1.23.5 | 134 | 10/18/2026 |
| 1.23.4 | 3,984 | 10/18/2026 |
| 1.23.3 | 70 | 10/17/2026 |
| 1.23.2 | 68 | 10/17/2026 |
| 1.23.1 | 67 | 10/17/2026 |
| 1.23.0 | 4,074 | 10/17/2026 |
| 1.22.3 | 64 | 10/17/2026 |
| 1.22.2 | 72 | 10/17/2026 |
| 1.22.1 | 72 | 10/17/2026 |
| 1.22.0 | 70 | 10/17/2026 |
| 1.21.0 | 66 | 10/17/2026 |