Path: redb-route/redb.Route/Definitions/SetHeadersDefinition.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/Definitions/SetHeadersDefinition.cs ---- using redb.Route.Abstractions; using redb.Route.Processors; namespace redb.Route.Definitions; /// /// Sets several headers in one step (one Message History entry). A value that is an /// is evaluated per message, a Func<IExchange, object?> is invoked, /// anything else is a constant. /// public sealed class SetHeadersDefinition : ProcessorDefinition { /// Creates the node. public SetHeadersDefinition(IReadOnlyList<(string Name, object? Value)> headers) { ArgumentNullException.ThrowIfNull(headers); if (headers.Count == 0) throw new ArgumentException("At least one header is required.", nameof(headers)); foreach (var (name, _) in headers) ArgumentException.ThrowIfNullOrWhiteSpace(name); Headers = headers; } /// Header names and value sources. public IReadOnlyList<(string Name, object? Value)> Headers { get; } /// public override IProcessor CreateProcessor(IRouteContext context) => new DelegateProcessor(exchange => { foreach (var (name, value) in Headers) exchange.In.Headers[name] = value switch { IExpression expression => expression.Evaluate(exchange), Func factory => factory(exchange), _ => value, }; }); }