Path: redb-route/redb.Route/Processors/InterceptProcessor.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/Processors/InterceptProcessor.cs ---- using redb.Route.Abstractions; namespace redb.Route.Processors; /// /// Runs the intercept steps before the intercepted processor (a route step for Intercept(), /// the whole route for InterceptFrom()). A condition that does not hold leaves the step /// untouched; a Stop() inside the intercept stops the exchange. /// internal sealed class InterceptProcessor : IProcessor { private readonly IProcessor _intercept; private readonly IPredicate? _condition; private readonly IProcessor _step; public InterceptProcessor(IProcessor intercept, IPredicate? condition, IProcessor step) { _intercept = intercept ?? throw new ArgumentNullException(nameof(intercept)); _condition = condition; _step = step ?? throw new ArgumentNullException(nameof(step)); } public async Task Process(IExchange exchange, CancellationToken ct = default) { if (_condition is null || await _condition.MatchesAsync(exchange).ConfigureAwait(false)) { await _intercept.Process(exchange, ct).ConfigureAwait(false); if (exchange.IsStopped) return; } await _step.Process(exchange, ct).ConfigureAwait(false); } }