Path: redb-route/redb.Route.Kafka/KafkaHeaderFilterStrategy.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.Kafka/KafkaHeaderFilterStrategy.cs ---- using redb.Route.Abstractions; namespace redb.Route.Kafka; /// /// The default of the Kafka component, Apache Camel's /// KafkaHeaderFilterStrategy: a header whose name starts with Camel, camel, org.apache.camel. /// or kafka. is neither sent on a record nor taken from one. An endpoint's headerFilterStrategy=#name /// replaces it; derive from it to add to it. /// /// So the component's own (all CamelKafka*) never reach the next hop, and a record /// that carries such a name cannot set them: the consumer sets them itself, whatever the strategy says. A sent header goes /// as its text, a null value as an empty one. A record's content-type header is the exchange's content type either /// way (the producer writes it from the exchange, the consumer reads it into the exchange). /// /// public class KafkaHeaderFilterStrategy : IHeaderFilterStrategy { /// The default strategy of a Kafka endpoint. public static KafkaHeaderFilterStrategy Default { get; } = new(); /// The prefixes Camel's strategy filters, in and out: its own (CAMEL_FILTER_STARTS_WITH) and kafka.. private static readonly string[] FilteredPrefixes = ["Camel", "camel", "org.apache.camel.", "kafka."]; /// Whether starts with one of the prefixes Camel's strategy filters. protected static bool IsFiltered(string name) { foreach (var prefix in FilteredPrefixes) if (name.StartsWith(prefix, StringComparison.Ordinal)) return true; return false; } /// public virtual bool FilterOutgoing(string name, object? value, IExchange exchange) => IsFiltered(name); /// public virtual bool FilterIncoming(string name, object? value, IExchange exchange) => IsFiltered(name); }