Table of Contents

Class TransportAdapterRouter

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

Default implementation of transport adapter router that routes messages through the dispatcher pipeline.

public sealed class TransportAdapterRouter : ITransportAdapterRouter
Inheritance
TransportAdapterRouter
Implements
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the TransportAdapterRouter class.

Constructors

TransportAdapterRouter(IDispatcher, ILogger<TransportAdapterRouter>)

Default implementation of transport adapter router that routes messages through the dispatcher pipeline.

public TransportAdapterRouter(IDispatcher dispatcher, ILogger<TransportAdapterRouter> logger)

Parameters

dispatcher IDispatcher

The dispatcher to route messages through.

logger ILogger<TransportAdapterRouter>

The logger.

Remarks

Initializes a new instance of the TransportAdapterRouter class.

Methods

CheckAdapterHealthAsync(CancellationToken)

Gets the health status of all registered transport adapters.

[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public Task<IDictionary<string, HealthCheckResult>> CheckAdapterHealthAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Token to cancel the health check operation.

Returns

Task<IDictionary<string, HealthCheckResult>>

A task containing the health check results for all adapters.

RegisterAdapterAsync(IMessageBusAdapter, string, CancellationToken)

Registers a transport adapter with the router for message routing.

[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public Task RegisterAdapterAsync(IMessageBusAdapter adapter, string adapterId, CancellationToken cancellationToken)

Parameters

adapter IMessageBusAdapter

The transport adapter to register.

adapterId string

The unique identifier for the adapter.

cancellationToken CancellationToken

Token to cancel the registration operation.

Returns

Task

A task representing the registration operation.

RouteAsync(IDispatchMessage, IMessageContext, string, CancellationToken)

Routes a message received from a transport adapter through the dispatcher pipeline.

[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public Task<IMessageResult> RouteAsync(IDispatchMessage message, IMessageContext context, string adapterId, CancellationToken cancellationToken)

Parameters

message IDispatchMessage

The message received from the transport.

context IMessageContext

The message context containing transport metadata.

adapterId string

The identifier of the transport adapter that received the message.

cancellationToken CancellationToken

Token to cancel the routing operation.

Returns

Task<IMessageResult>

A task representing the routing operation result.

RouteBatchAsync(IReadOnlyList<IDispatchMessage>, IReadOnlyList<IMessageContext>, string, CancellationToken)

Routes a message batch received from a transport adapter through the dispatcher pipeline.

public Task<IReadOnlyList<IMessageResult>> RouteBatchAsync(IReadOnlyList<IDispatchMessage> messages, IReadOnlyList<IMessageContext> contexts, string adapterId, CancellationToken cancellationToken)

Parameters

messages IReadOnlyList<IDispatchMessage>

The batch of messages received from the transport.

contexts IReadOnlyList<IMessageContext>

The message contexts for each message in the batch.

adapterId string

The identifier of the transport adapter that received the messages.

cancellationToken CancellationToken

Token to cancel the routing operation.

Returns

Task<IReadOnlyList<IMessageResult>>

A task representing the batch routing operation results.

UnregisterAdapterAsync(string, CancellationToken)

Unregisters a transport adapter from the router.

[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public Task UnregisterAdapterAsync(string adapterId, CancellationToken cancellationToken)

Parameters

adapterId string

The identifier of the adapter to unregister.

cancellationToken CancellationToken

Token to cancel the unregistration operation.

Returns

Task

A task representing the unregistration operation.