Path: redb-route/redb.Route/Abstractions/IPredicate.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/IPredicate.cs
----
namespace redb.Route.Abstractions;
///
/// Predicate for conditional message processing in route pipelines.
/// Determines whether a given condition is satisfied for a specific exchange.
/// Used by filter, choice, when, and other routing constructs.
///
public interface IPredicate
{
///
/// Evaluates the predicate synchronously against the exchange.
///
/// The exchange to test.
/// true if the condition is satisfied; otherwise false.
bool Matches(IExchange exchange);
///
/// Evaluates the predicate asynchronously against the exchange.
///
/// The exchange to test.
/// A task yielding true if the condition is satisfied; otherwise false.
Task MatchesAsync(IExchange exchange) => Task.FromResult(Matches(exchange));
}