Table of Contents

Interface IChangeFeedSubscription<TDocument>

Namespace
Excalibur.Data.CloudNative
Assembly
Excalibur.Data.Abstractions.dll

Represents a subscription to a cloud-native database change feed.

public interface IChangeFeedSubscription<TDocument> : IAsyncDisposable

Type Parameters

TDocument

The type of documents in the feed.

Inherited Members

Remarks

Change feeds provide real-time streaming of document changes for:

  • Cosmos DB: Change Feed
  • DynamoDB: DynamoDB Streams
  • Firestore: Real-time listeners / Cloud Functions triggers

This abstraction enables event-driven architectures including:

  • Event sourcing subscriptions
  • Materialized view updates
  • Outbox pattern processing
  • Real-time notifications

Properties

CheckpointLag

Gets how long checkpoint persistence has been degraded, or null when it is not.

TimeSpan? CheckpointLag { get; }

Property Value

TimeSpan?

The elapsed time since IsCheckpointDegraded became true, or null when it is false or not tracked.

IsActive

Gets a value indicating whether the subscription is active.

bool IsActive { get; }

Property Value

bool

IsCheckpointDegraded

Gets a value indicating whether checkpoint persistence has degraded: event delivery continues, but the redelivery window on a future restart can grow while this is true.

bool IsCheckpointDegraded { get; }

Property Value

bool

true when checkpoint saves have failed enough consecutive times to cross the configured bound; otherwise false. Defaults to false for a subscription that does not track checkpoint health.

SubscriptionId

Gets the subscription identifier.

string SubscriptionId { get; }

Property Value

string

Methods

ReadChangesAsync(CancellationToken)

Gets the async enumerable of change events.

IAsyncEnumerable<IChangeFeedEvent<TDocument>> ReadChangesAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

IAsyncEnumerable<IChangeFeedEvent<TDocument>>

An async enumerable of change feed events.

StartAsync(CancellationToken)

Starts the subscription and begins receiving changes.

Task StartAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task

A task representing the subscription startup.

StopAsync(CancellationToken)

Stops the subscription gracefully.

Task StopAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task

A task representing the graceful shutdown.