Table of Contents

Class DynamoDbStalePositionDetector

Namespace
Excalibur.Cdc.DynamoDb
Assembly
Excalibur.Cdc.DynamoDb.dll

Detects and classifies stale CDC position errors from DynamoDB Streams exceptions.

public static class DynamoDbStalePositionDetector
Inheritance
DynamoDbStalePositionDetector
Inherited Members

Remarks

DynamoDB Streams reports stale position scenarios through specific exception types:

  • ExpiredIteratorException - Iterator expired (15-minute timeout)
  • TrimmedDataAccessException - Data beyond 24-hour trim horizon
  • ResourceNotFoundException - Stream/shard not found

Properties

StalePositionExceptionTypes

Gets the set of AWS exception type names that indicate a stale CDC position.

public static IReadOnlySet<string> StalePositionExceptionTypes { get; }

Property Value

IReadOnlySet<string>

Methods

CreateEventArgs(Exception, string, DynamoDbCdcPosition?, DynamoDbCdcPosition?, string?, string?, string?, string?)

Creates a CdcPositionResetEventArgs from an exception and context.

public static CdcPositionResetEventArgs CreateEventArgs(Exception exception, string processorId, DynamoDbCdcPosition? stalePosition = null, DynamoDbCdcPosition? newPosition = null, string? streamArn = null, string? tableName = null, string? shardId = null, string? sequenceNumber = null)

Parameters

exception Exception

The exception that was caught.

processorId string

The identifier of the CDC processor.

stalePosition DynamoDbCdcPosition

The sequence number position that was detected as stale.

newPosition DynamoDbCdcPosition

The new position to resume from, if known.

streamArn string

The Stream ARN, if known.

tableName string

The table name, if known.

shardId string

The affected shard ID, if known.

sequenceNumber string

The stale sequence number, if known.

Returns

CdcPositionResetEventArgs

A populated CdcPositionResetEventArgs instance.

GetReasonCode(Exception?)

Determines the appropriate reason code from a DynamoDB exception.

public static string GetReasonCode(Exception? exception)

Parameters

exception Exception

The DynamoDB exception to analyze.

Returns

string

The reason code string.

GetStalePositionExceptionType(Exception?)

Extracts the AWS exception type name that indicates a stale position from the exception.

public static string? GetStalePositionExceptionType(Exception? exception)

Parameters

exception Exception

The exception to analyze.

Returns

string

The exception type name if found; otherwise, null.

IsStalePositionException(Exception?)

Determines whether the specified exception indicates a stale CDC position.

public static bool IsStalePositionException(Exception? exception)

Parameters

exception Exception

The exception to analyze.

Returns

bool

true if the exception indicates a stale position; otherwise, false.