Path: redb-route/redb.Route/Abstractions/IHeaderFilterStrategy.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/IHeaderFilterStrategy.cs
----
namespace redb.Route.Abstractions;
///
/// Decides which headers a transport carries between an exchange and the messages of its protocol: the HTTP request
/// and response headers, the headers of a Kafka record, the application properties of an AMQP or Service Bus message.
/// Apache Camel's HeaderFilterStrategy.
///
/// Two directions, asked about every header one by one:
///
/// - — the exchange's header is about to go into an outgoing message: the request a
/// producer sends, the reply a consumer sends back (Camel: applyFilterToCamelHeaders);
/// - — a header of an incoming message is about to come into the exchange: the
/// message a consumer receives, the reply a producer gets (Camel: applyFilterToExternalHeaders).
///
/// Both return true to drop the header and false to let it through, as in Camel.
///
///
/// Every transport that carries arbitrary headers has a default strategy that keeps its documented behaviour; a
/// strategy set on an endpoint (headerFilterStrategy=#name) replaces that default entirely. A strategy decides
/// about the headers of the route only: the fields a transport sets itself (trace context, content type, the native
/// properties of the message) do not go through it. covers the usual
/// cases — a list of names, a regular expression, name prefixes — as a blacklist or a whitelist.
///
///
public interface IHeaderFilterStrategy
{
///
/// Whether the exchange header is dropped instead of going into an outgoing message
/// (a producer's request, a consumer's reply).
///
/// The header name.
/// The header value; may be null.
/// The exchange the header belongs to.
/// true to drop the header; false to send it.
bool FilterOutgoing(string name, object? value, IExchange exchange);
///
/// Whether the header of an incoming message (a consumed message, a producer's reply) is
/// dropped instead of coming into the exchange.
///
/// The header name as the protocol carries it.
/// The header value; may be null.
/// The exchange the header would come into.
/// true to drop the header; false to take it.
bool FilterIncoming(string name, object? value, IExchange exchange);
}