Skip to content
Tracon

IWebhookStore

Namespace Tracon · Assembly Tracon.Abstractions.dll

The store for webhook subscriptions and delivery history.

public interface IWebhookStore

Delivery guarantee — AT-LEAST-ONCE. A row created by IWebhookStore.CreateDeliveryAsync can be attempted more than once: the delivery job (an IJobHandler, itself at-least-once — see IJobHandler.ExecuteAsync’s own remarks) retries a failed HTTP POST against the SAME WebhookDelivery.Id, and each attempt is recorded with its own IWebhookStore.RecordDeliveryResultAsync call rather than overwriting the last one. This store neither deduplicates nor collapses those attempts — it is IWebhookPublisher’s and the recipient’s job to do so; see IWebhookPublisher’s remarks for the header a recipient uses to recognize a retry.

CreateDeliveryAsync(WebhookDelivery, CancellationToken)

Section titled “ CreateDeliveryAsync(WebhookDelivery, CancellationToken)”

Creates a delivery record.

ValueTask<WebhookDelivery> CreateDeliveryAsync(WebhookDelivery delivery, CancellationToken cancellationToken = default)

delivery WebhookDelivery

The delivery.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WebhookDelivery>

The created record.

DeleteSubscriptionAsync(string, string, CancellationToken)

Section titled “ DeleteSubscriptionAsync(string, string, CancellationToken)”

Deletes a subscription and its delivery history.

ValueTask<bool> DeleteSubscriptionAsync(string tenantId, string name, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

name string

The subscription name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<bool>

true if the delete happened.

FindForEventAsync(string, string, CancellationToken)

Section titled “ FindForEventAsync(string, string, CancellationToken)”

Fetches all enabled subscriptions subscribed to a specific event.

ValueTask<IReadOnlyList<WebhookSubscription>> FindForEventAsync(string tenantId, string eventType, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

eventType string

The event name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<WebhookSubscription>>

The matching subscriptions. An empty list if none.

GetDeliveryAsync(Guid, CancellationToken)

Section titled “ GetDeliveryAsync(Guid, CancellationToken)”

Fetches a single delivery record.

ValueTask<WebhookDelivery?> GetDeliveryAsync(Guid deliveryId, CancellationToken cancellationToken = default)

deliveryId Guid

The delivery identifier.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WebhookDelivery?>

The record; null if it does not exist.

GetSubscriptionAsync(string, string, CancellationToken)

Section titled “ GetSubscriptionAsync(string, string, CancellationToken)”

Fetches a single subscription by name.

ValueTask<WebhookSubscription?> GetSubscriptionAsync(string tenantId, string name, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

name string

The subscription name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WebhookSubscription?>

The subscription; null if it does not exist.

ListSubscriptionsAsync(string, CancellationToken)

Section titled “ ListSubscriptionsAsync(string, CancellationToken)”

Lists a tenant’s subscriptions.

ValueTask<IReadOnlyList<WebhookSubscription>> ListSubscriptionsAsync(string tenantId, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<WebhookSubscription>>

The subscriptions.

QueryDeliveriesAsync(WebhookDeliveryQuery, CancellationToken)

Section titled “ QueryDeliveriesAsync(WebhookDeliveryQuery, CancellationToken)”

Lists delivery history. The newest record is returned first.

ValueTask<IReadOnlyList<WebhookDelivery>> QueryDeliveriesAsync(WebhookDeliveryQuery query, CancellationToken cancellationToken = default)

query WebhookDeliveryQuery

The filter.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<WebhookDelivery>>

The records.

RecordDeliveryResultAsync(WebhookDeliveryResult, CancellationToken)

Section titled “ RecordDeliveryResultAsync(WebhookDeliveryResult, CancellationToken)”

Writes a delivery attempt’s result.

ValueTask RecordDeliveryResultAsync(WebhookDeliveryResult result, CancellationToken cancellationToken = default)

result WebhookDeliveryResult

The result.

cancellationToken CancellationToken

The cancellation token.

ValueTask

The completion task.

RecordSubscriptionOutcomeAsync(Guid, bool, int, DateTimeOffset, CancellationToken)

Section titled “ RecordSubscriptionOutcomeAsync(Guid, bool, int, DateTimeOffset, CancellationToken)”

Updates a subscription’s consecutive-failure counter, and disables the subscription if the threshold is exceeded.

ValueTask<bool> RecordSubscriptionOutcomeAsync(Guid subscriptionId, bool succeeded, int disableThreshold, DateTimeOffset updatedAt, CancellationToken cancellationToken = default)

subscriptionId Guid

The subscription identifier.

succeeded bool

Whether the most recent delivery succeeded.

disableThreshold int

The subscription is disabled after this many consecutive failures.

updatedAt DateTimeOffset

The update time (UTC).

cancellationToken CancellationToken

The cancellation token.

ValueTask<bool>

true if the subscription was disabled during this call.

SaveSubscriptionAsync(WebhookSubscription, CancellationToken)

Section titled “ SaveSubscriptionAsync(WebhookSubscription, CancellationToken)”

Creates or updates a subscription.

ValueTask<WebhookSubscription> SaveSubscriptionAsync(WebhookSubscription subscription, CancellationToken cancellationToken = default)

subscription WebhookSubscription

The subscription.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WebhookSubscription>

The saved subscription.