Skip to content

Resiliency

Baseline resiliency is inherited from the Base Template. Metering-specific considerations:

Idempotent provisioning

EnsureUsageMeterProvisionedInput is designed to be idempotent (load-or-create per tenant+dimension), so the tenant-activation and subscription-created sagas can safely replay without creating duplicate meters. The UQ_UsageMeters_Tenant_Dimension constraint backs this.

One-shot quota signals

ThresholdCrossedEmitted and QuotaExceededEmitted flags ensure threshold/exceeded events are emitted once per cycle even under repeated RecordUsageAsync calls. RollUsageCounterAsync clears these flags at the start of a new billing period.

Counter increments

UsageMeterGrain (keyed {tenantId}:{dimension}) serializes increments so concurrent RecordUsage calls do not lose counts.

In-memory saga repositories

Sagas use in-memory repositories by default; for production durability, configure persistent saga storage along with a durable transport (MassTransit:PersistenceType).

See also