Table of Contents

Class DelegatingTransportSender

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

Base class for transport sender decorators that delegate to an inner sender. Follows the DelegatingChatClient pattern from Microsoft.Extensions.AI — all virtual methods forward to the inner sender. Subclasses override specific methods to add behavior (telemetry, ordering, deduplication, etc.).

public abstract class DelegatingTransportSender : ITransportSender, IAsyncDisposable
Inheritance
DelegatingTransportSender
Implements
Inherited Members
Extension Methods

Constructors

DelegatingTransportSender(ITransportSender)

Initializes a new instance of the DelegatingTransportSender class.

protected DelegatingTransportSender(ITransportSender innerSender)

Parameters

innerSender ITransportSender

The inner sender to delegate to.

Properties

Destination

Gets the destination name (queue or topic) this sender is configured for.

public virtual string Destination { get; }

Property Value

string

The destination name.

InnerSender

Gets the inner sender that this decorator delegates to.

protected ITransportSender InnerSender { get; }

Property Value

ITransportSender

The inner ITransportSender.

Methods

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public virtual ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

FlushAsync(CancellationToken)

Flushes any pending messages in internal buffers.

public virtual Task FlushAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token for the operation.

Returns

Task

Task representing the flush operation.

GetService(Type)

Gets the underlying transport service (e.g., IProducer, ServiceBusSender, IAmazonSQS).

public virtual object? GetService(Type serviceType)

Parameters

serviceType Type

The type of service to retrieve.

Returns

object

The service instance, or null if not available.

Remarks

Follows the IChatClient.GetService() pattern from Microsoft.Extensions.AI. Returns null if the requested service type is not available.

The default implementation answers for any service this instance itself implements, so a transport that provides one directly need not override it. A transport overrides it to hand out its native SDK handle, and a decorator overrides it to answer for itself before deferring to the transport it wraps.

Exceptions

ArgumentNullException

Thrown when serviceType is null.

SendAsync(TransportMessage, CancellationToken)

Sends a single message to the destination.

public virtual Task<SendResult> SendAsync(TransportMessage message, CancellationToken cancellationToken)

Parameters

message TransportMessage

The message to send.

cancellationToken CancellationToken

Cancellation token for the operation.

Returns

Task<SendResult>

The result of the send operation.

SendBatchAsync(IReadOnlyList<TransportMessage>, CancellationToken)

Sends multiple messages as a batch to the destination.

public virtual Task<BatchSendResult> SendBatchAsync(IReadOnlyList<TransportMessage> messages, CancellationToken cancellationToken)

Parameters

messages IReadOnlyList<TransportMessage>

The messages to send.

cancellationToken CancellationToken

Cancellation token for the operation.

Returns

Task<BatchSendResult>

The results of the batch send operation. Results carries exactly one entry per input, index-aligned with messages; see that property for the full contract every implementation must satisfy, including how entries that took a fallback path are reported.