Table of Contents

Default Headers

Silverback will add some headers to the produced messages. They may vary depending on the scenario. Here is the list of the default headers that may be sent.

The static classes DefaultMessageHeaders and KafkaMessageHeaders contain all default header names constants.

Default

Header Name
MessageType x-message-type
FailedAttempts x-failed-attempts
ChunkIndex x-chunk-index
ChunksCount x-chunk-count
IsLastChunk x-chunk-last
TraceId traceparent
TraceState tracestate
TraceBaggage tracebaggage
ContentType content-type
EncryptionKeyId x-encryption-key-id
FailureReason x-failure-reason

Kafka

Header Name
Timestamp x-kafka-message-timestamp
SourceConsumerGroupId x-source-consumer-group-id
SourceTopic x-source-topic
SourcePartition x-source-partition
SourceOffset x-source-offset
SourceTimestamp x-source-timestamp
FirstChunkOffset x-chunk-first-offset

MQTT

Header Name

Customizing Default Header Names

The default header names can be overridden using the WithCustomHeaderName configuration method.

services.AddSilverback()
    .WithConnectionToMessageBroker(options => options.AddKafka())
    .WithCustomHeaderName(DefaultMessageHeaders.ChunkId, "x-ch-id")
    .WithCustomHeaderName(DefaultMessageHeaders.ChunksCount, "x-ch-cnt")
    .AddBrokerClientsConfigurator<MyClientsConfigurator>();