Class KafkaToRabbitMqMapper
Message mapper for converting Kafka messages to RabbitMQ format.
public sealed class KafkaToRabbitMqMapper : DefaultMessageMapper, IMessageMapper
- Inheritance
-
KafkaToRabbitMqMapper
- Implements
- Inherited Members
- Extension Methods
Remarks
This mapper handles the property translation between Kafka and RabbitMQ transports.
Properties stored in Kafka headers using the x- prefix convention are restored
to their native RabbitMQ equivalents.
Property Mapping:
| Kafka | RabbitMQ |
|---|---|
| Key | RoutingKey (direct mapping) |
| Header x-priority | Priority (restored if present) |
| Header x-expiration | Expiration (restored if present) |
| Header x-reply-to | ReplyTo (restored if present) |
| Topic | Not mapped (different routing paradigm) |
| Partition/Offset | Omitted (Kafka-specific) |
Constructors
KafkaToRabbitMqMapper()
Initializes a new instance of the KafkaToRabbitMqMapper class.
public KafkaToRabbitMqMapper()
Fields
ExpirationHeader
Header name for restoring RabbitMQ expiration from Kafka messages.
public const string ExpirationHeader = "x-expiration"
Field Value
PriorityHeader
Header name for restoring RabbitMQ priority from Kafka messages.
public const string PriorityHeader = "x-priority"
Field Value
ReplyToHeader
Header name for restoring RabbitMQ reply-to from Kafka messages.
public const string ReplyToHeader = "x-reply-to"
Field Value
Methods
CopyTransportProperties(ITransportMessageContext, TransportMessageContext)
Copies transport-specific properties from source to target context.
protected override void CopyTransportProperties(ITransportMessageContext source, TransportMessageContext target)
Parameters
sourceITransportMessageContextThe source context.
targetTransportMessageContextThe target context.
Remarks
Override this method to customize how transport properties are copied or transformed.