Class ChoiceProcessor
Content-based router: evaluates when-clauses in order,
executes the first matching branch. Falls through to Otherwise if no match.
public class ChoiceProcessor : IProcessor
Inheritance
Implements
Properties
Otherwise
Gets the fallback processor (executed when no when-clause matches).
public IProcessor? Otherwise { get; }
Methods
Process(IExchange, CancellationToken)
Processes the exchange asynchronously.
public Task Process(IExchange exchange, CancellationToken ct = default)
SetOtherwise(IProcessor)
Sets the otherwise (fallback) processor.
public ChoiceProcessor SetOtherwise(IProcessor processor)
When(Func<IExchange, bool>, IProcessor)
Adds a when-clause to the choice.
public ChoiceProcessor When(Func<IExchange, bool> predicate, IProcessor processor)
When(IPredicate, IProcessor)
Adds a When branch guarded by a predicate instance.
public ChoiceProcessor When(IPredicate condition, IProcessor processor)