Path: redb-route/redb.Route.Kafka/KafkaHeaders.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/KafkaHeaders.cs
----
namespace redb.Route.Kafka;
///
/// The headers of the Kafka component, with Apache Camel's names and types (KafkaConstants of camel-kafka), so a
/// route written for Camel reads and sets them unchanged. None of them goes on the wire:
/// keeps every Camel* header off a sent record, as Camel's does.
///
public static class KafkaHeaders
{
// ── Set by the consumer on every record (Camel's KafkaRecordProcessor.setupExchangeMessage) ──
/// The topic of the consumed record (KafkaConstants.TOPIC), a .
public const string Topic = "CamelKafkaTopic";
/// The partition the record was stored in (KafkaConstants.PARTITION), an .
public const string Partition = "CamelKafkaPartition";
/// The offset of the record in its partition (KafkaConstants.OFFSET), a .
public const string Offset = "CamelKafkaOffset";
///
/// The record's timestamp (KafkaConstants.TIMESTAMP), a of milliseconds since the Unix epoch,
/// as Kafka and Camel give it. Not set when the record carries none.
///
public const string Timestamp = "CamelKafkaTimestamp";
///
/// The record's headers as Kafka gave them (KafkaConstants.HEADERS): the Confluent.Kafka.Headers of the
/// record, with their raw bytes. The same headers, as text and as the strategy lets them in, are message headers too.
///
public const string Headers = "CamelKafkaHeaders";
// ── Set by the consumer, read by the producer ──
///
/// The key of the record (KafkaConstants.KEY), a . Consumer: the key of the consumed record,
/// when it has one. Producer: the key of the sent record when the endpoint's key option is not set, which takes
/// precedence, as in Camel; a route passing records on keeps their keys.
///
public const string Key = "CamelKafkaKey";
// ── Read by the producer ──
///
/// The partition a sent record goes to, per message (KafkaConstants.PARTITION_KEY): an integer, or a
/// whole-number text. The endpoint's partitionKey option takes precedence over it, as in Camel.
///
public const string PartitionKey = "CamelKafkaPartitionKey";
///
/// The topic a sent record goes to instead of the endpoint's, per message (KafkaConstants.OVERRIDE_TOPIC): a
/// . The producer removes it from the message, so it does not travel further.
///
public const string OverrideTopic = "CamelKafkaOverrideTopic";
///
/// The timestamp of a sent record, per message (KafkaConstants.OVERRIDE_TIMESTAMP): milliseconds since the Unix
/// epoch as a (or a whole-number text), or a or .
/// The producer removes it from the message.
///
public const string OverrideTimestamp = "CamelKafkaOverrideTimestamp";
// ── Set by the producer ──
///
/// With recordMetadata=true, the metadata of what the producer sent (KafkaConstants.KAFKA_RECORD_META): a
/// List<KafkaRecordMetadata>, one entry per sent record (a list body gives one per element), as Camel's
/// list of RecordMetadata.
///
public const string RecordMeta = "CamelKafkaRecordMeta";
}
///
/// The metadata of one sent record, the fields of Kafka's RecordMetadata that Camel puts in
/// : its topic, partition, offset and timestamp (milliseconds since the Unix epoch,
/// the record's timestamp as the broker stored it).
///
public sealed record KafkaRecordMetadata(string Topic, int Partition, long Offset, long Timestamp);