Class DynamoDbOutboxStreamsSubscription
DynamoDB Streams subscription specialized for outbox messages. Only emits unpublished messages (new inserts that are not yet published).
[SuppressMessage("Maintainability", "CA1506:Avoid excessive class coupling", Justification = "Change feed implementations inherently couple with many SDK and abstraction types.")]
public sealed class DynamoDbOutboxStreamsSubscription : IChangeFeedSubscription<CloudOutboxMessage>, IAsyncDisposable
- Inheritance
-
DynamoDbOutboxStreamsSubscription
- Implements
- Inherited Members
Remarks
This subscription filters stream events to only emit unpublished outbox messages, making it suitable for push-based outbox processing. Published messages and updates are filtered out.
Constructors
DynamoDbOutboxStreamsSubscription(IAmazonDynamoDB, IAmazonDynamoDBStreams, DynamoDbOutboxOptions, IChangeFeedOptions, ILogger)
Initializes a new instance of the DynamoDbOutboxStreamsSubscription class.
public DynamoDbOutboxStreamsSubscription(IAmazonDynamoDB client, IAmazonDynamoDBStreams streamsClient, DynamoDbOutboxOptions storeOptions, IChangeFeedOptions options, ILogger logger)
Parameters
clientIAmazonDynamoDBThe DynamoDB client.
streamsClientIAmazonDynamoDBStreamsThe DynamoDB Streams client.
storeOptionsDynamoDbOutboxOptionsThe outbox store options. The table name and the key attribute names are read from here, so a table whose key attributes are named anything other than the defaults is read back correctly.
optionsIChangeFeedOptionsThe change feed options.
loggerILoggerThe logger.
Properties
CurrentContinuationToken
public string? CurrentContinuationToken { get; }
Property Value
IsActive
Gets a value indicating whether the subscription is active.
public bool IsActive { get; }
Property Value
SubscriptionId
Gets the subscription identifier.
public string SubscriptionId { get; }
Property Value
Methods
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
ReadChangesAsync(CancellationToken)
Gets the async enumerable of change events.
public IAsyncEnumerable<IChangeFeedEvent<CloudOutboxMessage>> ReadChangesAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- IAsyncEnumerable<IChangeFeedEvent<CloudOutboxMessage>>
An async enumerable of change feed events.
StartAsync(CancellationToken)
Starts the subscription and begins receiving changes.
public Task StartAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the subscription startup.
StopAsync(CancellationToken)
Stops the subscription gracefully.
public Task StopAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the graceful shutdown.