Path: redb-route/redb.Route/Abstractions/ISagaDefinition.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Abstractions/ISagaDefinition.cs
----
namespace redb.Route.Abstractions;
///
/// Fluent builder for configuring saga steps with forward actions and compensation.
///
public interface ISagaDefinition
{
/// Adds a synchronous saga step with compensation.
/// Forward action to execute.
/// Compensation action to run on rollback.
/// This definition for chaining.
ISagaDefinition Step(Action action, Action compensate);
/// Adds an async saga step with compensation.
/// Forward action to execute.
/// Compensation action to run on rollback.
/// This definition for chaining.
ISagaDefinition Step(
Func action,
Func compensate);
/// Adds a forward-only saga step (no compensation on rollback).
/// Forward action to execute.
/// This definition for chaining.
ISagaDefinition Step(Action action);
/// Adds an async forward-only saga step (no compensation on rollback).
/// Forward action to execute.
/// This definition for chaining.
ISagaDefinition Step(Func action);
///
/// Adds a saga step from processor instances — the seam declarative forms use (Route-XML
/// <saga>: steps are #name registry references to s).
///
/// Forward processor.
/// Compensation processor to run on rollback; null for forward-only.
/// This definition for chaining.
ISagaDefinition Step(IProcessor action, IProcessor? compensate = null);
/// Sets a callback invoked when all saga steps complete successfully.
/// Callback to invoke on saga completion.
/// This definition for chaining.
ISagaDefinition OnCompletion(Action callback);
/// Sets an async callback invoked when all saga steps complete successfully.
/// Callback to invoke on saga completion.
/// This definition for chaining.
ISagaDefinition OnCompletion(Func callback);
}