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
connectionStringstringPostgreSQL 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
nowDateTimeOffsetReference instant; entries with
ExpiresAt <= noware removed.ctCancellationTokenCancellation token.
Returns
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
flowIdGuidFlow identifier scoping the dedup window.
triggerKeystringTrigger key scoping the dedup window.
noncestringUnique-per-event token (timestamp + delivery-id, etc.).
expiresAtDateTimeOffsetWhen the entry may be purged.
ctCancellationTokenCancellation propagated from the host pipeline.