Table of Contents

Class DefaultRoutingKeyResolver

Namespace
CarrotMQ.Core.MessageProcessing
Assembly
CarrotMQ.Core.dll

Default implementation of IRoutingKeyResolver that generates routing keys based on the FullName of the specified request type, ensuring the length is within the allowed limit.

public class DefaultRoutingKeyResolver : IRoutingKeyResolver
Inheritance
DefaultRoutingKeyResolver
Implements
Inherited Members

Constructors

DefaultRoutingKeyResolver()

public DefaultRoutingKeyResolver()

Fields

Ellipsis

The ellipsis used to indicate truncated content in the routing key.

public const string Ellipsis = "..."

Field Value

string

MaxLength

The maximum length allowed for a routing key as defined in the AMQP Protocol

public const int MaxLength = 256

Field Value

int

Methods

GetRoutingKey<TRequest>(string)

Gets the routing key based on the FullName of the specified request type. If the FullName exceeds the maximum length, the namespace part is truncated.

public string GetRoutingKey<TRequest>(string exchangeName)

Parameters

exchangeName string

The name of the messaging exchange associated with the routing key.

Returns

string

The generated routing key.

Type Parameters

TRequest

The type of the request for which to generate the routing key.