Table of Contents

Interface IAwsSqsFifoBuilder

Namespace
Excalibur.Dispatch.Transport.Aws
Assembly
Excalibur.Dispatch.Transport.AwsSqs.dll

Fluent builder interface for configuring AWS SQS FIFO queue settings.

public interface IAwsSqsFifoBuilder
Extension Methods

Examples

services.AddAwsSqsTransport(sqs =>
{
    sqs.ConfigureFifo(fifo =>
    {
        fifo.ContentBasedDeduplication(true)
            .MessageGroupIdSelector<OrderCreated>(msg => msg.TenantId);
    });
});

Remarks

This interface follows the Microsoft-style fluent builder pattern. All methods return this for method chaining.

FIFO queues require either ContentBasedDeduplication(bool) or a DeduplicationIdSelector<T>(Func<T, string>) to be configured. Additionally, a MessageGroupIdSelector<T>(Func<T, string>) is required.

Methods

ContentBasedDeduplication(bool)

Enables or disables content-based deduplication.

IAwsSqsFifoBuilder ContentBasedDeduplication(bool enabled)

Parameters

enabled bool

true to enable content-based deduplication; false to disable it. Default is false.

Returns

IAwsSqsFifoBuilder

The builder for fluent chaining.

Remarks

When enabled, SQS uses a SHA-256 hash of the message body to generate the deduplication ID. Messages with identical content within the 5-minute deduplication window are treated as duplicates.

DeduplicationIdSelector(Func<object, string>)

Sets a function that generates a deduplication ID from any message object.

IAwsSqsFifoBuilder DeduplicationIdSelector(Func<object, string> selector)

Parameters

selector Func<object, string>

A function that generates a unique deduplication ID from the message object.

Returns

IAwsSqsFifoBuilder

The builder for fluent chaining.

Examples

.DeduplicationIdSelector(msg => $"{msg.GetType().Name}-{((dynamic)msg).Id}")

Remarks

Use this overload when you need a single selector that works with multiple message types. For type-safe selectors, use DeduplicationIdSelector<T>(Func<T, string>).

Exceptions

ArgumentNullException

Thrown when selector is null.

DeduplicationIdSelector<T>(Func<T, string>)

Sets a type-safe function that generates a deduplication ID from a message.

IAwsSqsFifoBuilder DeduplicationIdSelector<T>(Func<T, string> selector)

Parameters

selector Func<T, string>

A function that generates a unique deduplication ID from the message.

Returns

IAwsSqsFifoBuilder

The builder for fluent chaining.

Type Parameters

T

The message type.

Examples

.DeduplicationIdSelector<OrderCreated>(msg => $"order-{msg.OrderId}")

Remarks

The deduplication ID prevents duplicate message delivery within a 5-minute window. If content-based deduplication is disabled, this selector is required.

Exceptions

ArgumentNullException

Thrown when selector is null.

MessageGroupIdSelector(Func<object, string>)

Sets a function that generates a message group ID from any message object.

IAwsSqsFifoBuilder MessageGroupIdSelector(Func<object, string> selector)

Parameters

selector Func<object, string>

A function that generates a message group ID from the message object.

Returns

IAwsSqsFifoBuilder

The builder for fluent chaining.

Examples

// Global ordering (all messages in same group)
.MessageGroupIdSelector(_ => "global")

// Dynamic tenant extraction
.MessageGroupIdSelector(msg => ((ITenantMessage)msg).TenantId)

Remarks

Use this overload when you need a single selector that works with multiple message types. For type-safe selectors, use MessageGroupIdSelector<T>(Func<T, string>).

Exceptions

ArgumentNullException

Thrown when selector is null.

MessageGroupIdSelector<T>(Func<T, string>)

Sets a type-safe function that generates a message group ID from a message.

IAwsSqsFifoBuilder MessageGroupIdSelector<T>(Func<T, string> selector)

Parameters

selector Func<T, string>

A function that generates a message group ID from the message.

Returns

IAwsSqsFifoBuilder

The builder for fluent chaining.

Type Parameters

T

The message type.

Examples

// Order by tenant
.MessageGroupIdSelector<OrderCreated>(msg => msg.TenantId)

// Order by aggregate
.MessageGroupIdSelector<OrderCreated>(msg => msg.OrderId.ToString())

Remarks

The message group ID determines the ordering boundary. Messages with the same group ID are processed in strict FIFO order. Different groups can be processed in parallel while maintaining order within each group.

Exceptions

ArgumentNullException

Thrown when selector is null.