Table of Contents

Class PostgreSqlWebhookReplayStore

Namespace
FlowOrchestrator.PostgreSQL
Assembly
FlowOrchestrator.PostgreSQL.dll

Dapper-based PostgreSQL implementation of IWebhookReplayStore. Persists nonces in the webhook_replay_nonces table created by PostgreSqlFlowOrchestratorMigrator.

public sealed class PostgreSqlWebhookReplayStore : IWebhookReplayStore
Inheritance
PostgreSqlWebhookReplayStore
Implements
Inherited Members

Constructors

PostgreSqlWebhookReplayStore(string)

Creates the store bound to the given connection string.

public PostgreSqlWebhookReplayStore(string connectionString)

Parameters

connectionString string

PostgreSQL connection string.

Methods

PurgeExpiredAsync(DateTimeOffset, CancellationToken)

Drops every entry whose ExpiresAt is at or before now.

public ValueTask<int> PurgeExpiredAsync(DateTimeOffset now, CancellationToken ct = default)

Parameters

now DateTimeOffset

Reference instant; entries with ExpiresAt <= now are removed.

ct CancellationToken

Cancellation token.

Returns

ValueTask<int>

TryRegisterAsync(Guid, string, string, DateTimeOffset, CancellationToken)

Atomically records the nonce. Returns true when the nonce had not been seen for this flow + trigger; false when the same tuple is already present (replay).

public ValueTask<bool> TryRegisterAsync(Guid flowId, string triggerKey, string nonce, DateTimeOffset expiresAt, CancellationToken ct = default)

Parameters

flowId Guid

Flow identifier scoping the dedup window.

triggerKey string

Trigger key scoping the dedup window.

nonce string

Unique-per-event token (timestamp + delivery-id, etc.).

expiresAt DateTimeOffset

When the entry may be purged.

ct CancellationToken

Cancellation propagated from the host pipeline.

Returns

ValueTask<bool>