Table of Contents

Interface IMessageMapper

Namespace
Excalibur.Dispatch.Transport
Assembly
Excalibur.Dispatch.Abstractions.dll

Defines a mapper that transforms messages between different transport formats.

public interface IMessageMapper
Extension Methods

Remarks

Message mappers enable multi-transport scenarios by transforming messages as they move between different messaging systems (e.g., RabbitMQ to Kafka, or internal to external format).

Mappers operate on the transport context level, allowing transformation of:

  • Message headers and metadata
  • Transport-specific properties (routing keys, partition keys, etc.)
  • Correlation and tracing information

For message payload transformation, implement IMessageMapper<TSource, TTarget>.

Properties

Name

Gets the name of this mapper for registration and logging purposes.

string Name { get; }

Property Value

string

A unique name identifying this mapper.

SourceTransport

Gets the source transport type this mapper handles.

string SourceTransport { get; }

Property Value

string

The source transport name (e.g., "rabbitmq", "kafka", "*" for any).

TargetTransport

Gets the target transport type this mapper produces.

string TargetTransport { get; }

Property Value

string

The target transport name (e.g., "rabbitmq", "kafka", "*" for any).

Methods

CanMap(string, string)

Determines whether this mapper can handle the specified source and target transports.

bool CanMap(string sourceTransport, string targetTransport)

Parameters

sourceTransport string

The source transport name.

targetTransport string

The target transport name.

Returns

bool

true if this mapper can handle the transformation; otherwise, false.

Map(ITransportMessageContext, string)

Maps a source context to a target context for cross-transport delivery.

ITransportMessageContext Map(ITransportMessageContext source, string targetTransportName)

Parameters

source ITransportMessageContext

The source transport message context.

targetTransportName string

The name of the target transport.

Returns

ITransportMessageContext

A new context configured for the target transport.

Exceptions

ArgumentNullException

Thrown when source is null.

InvalidOperationException

Thrown when the mapper cannot handle the specified transport combination.