Path: redb-route/redb.Route/Transactions/RollbackTransactionProcessor.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/Transactions/RollbackTransactionProcessor.cs ---- using System.Transactions; using Microsoft.Extensions.Logging; using redb.Route.Abstractions; namespace redb.Route.Transactions; /// /// Imperative transaction processor that rolls back the /// previously opened by . /// Rolls back all deferred instances, then disposes the scope /// without calling . Joined to an enclosing block, it marks the enclosing /// transaction for rollback, and the enclosing block rolls back the database and every send. /// public sealed class RollbackTransactionProcessor : IProcessor { private readonly ILogger? _logger; /// Creates a rollback-transaction processor. /// Optional logger. public RollbackTransactionProcessor(ILogger? logger = null) { _logger = logger; } /// public async Task Process(IExchange exchange, CancellationToken ct = default) { if (!exchange.Properties.TryGetValue(BeginTransactionProcessor.ScopePropertyKey, out var raw) || raw is not TransactionScope scope) { _logger?.LogWarning("RollbackTransaction called but no active transaction scope found on exchange."); return; } exchange.Properties.Remove(BeginTransactionProcessor.ScopePropertyKey); var ownsActions = BeginTransactionProcessor.TryTakeOwnActions(exchange, out var enclosing); try { if (ownsActions) await TransactedActions.RollbackAll(exchange, _logger, ct).ConfigureAwait(false); // Dispose without Complete → automatic rollback scope.Dispose(); } finally { if (ownsActions) TransactedActions.Close(exchange, enclosing); } _logger?.LogDebug("Transaction rolled back imperatively."); } }