Table of Contents

Class DefaultMessageMapper

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

Default message mapper that copies context properties between transports.

public class DefaultMessageMapper : IMessageMapper
Inheritance
DefaultMessageMapper
Implements
Derived
Inherited Members
Extension Methods

Remarks

This mapper provides basic property copying between transport contexts. It preserves all common properties (MessageId, CorrelationId, etc.) and allows transport-specific properties to be mapped via configuration.

Constructors

DefaultMessageMapper(string, string, string)

Initializes a new instance of the DefaultMessageMapper class.

public DefaultMessageMapper(string name, string sourceTransport = "*", string targetTransport = "*")

Parameters

name string

The mapper name.

sourceTransport string

The source transport (or "*" for any).

targetTransport string

The target transport (or "*" for any).

Fields

WildcardTransport

Gets the wildcard transport identifier for matching any transport.

public const string WildcardTransport = "*"

Field Value

string

Properties

Name

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

public string Name { get; }

Property Value

string

A unique name identifying this mapper.

SourceTransport

Gets the source transport type this mapper handles.

public 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.

public 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.

public 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.

CopyTransportProperties(ITransportMessageContext, TransportMessageContext)

Copies transport-specific properties from source to target context.

protected virtual void CopyTransportProperties(ITransportMessageContext source, TransportMessageContext target)

Parameters

source ITransportMessageContext

The source context.

target TransportMessageContext

The target context.

Remarks

Override this method to customize how transport properties are copied or transformed.

CreateTargetContext(string, string)

Creates the appropriate target context for the specified transport.

protected virtual TransportMessageContext CreateTargetContext(string messageId, string targetTransport)

Parameters

messageId string

The message ID to use.

targetTransport string

The target transport name.

Returns

TransportMessageContext

A new transport message context instance.

Map(ITransportMessageContext, string)

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

public virtual 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.