Resiliency¶
General resiliency (retries, circuit breakers, health checks, graceful shutdown) is inherited from the Base Template. Billing-specific considerations:
Messaging outbox¶
MassTransitExtensions uses UseInMemoryOutbox(context) on the in-memory transport path so event publication is consistent with the handling transaction. For production transports, enable a durable outbox/persistence (MassTransit:PersistenceType).
Saga reliability¶
Billing's six state machines (SubscriptionLifecycleStateMachine, plus tenant/entitlements/catalog/metering reaction sagas) coordinate cross-context workflows. Because Billing reacts to events from Tenants, Catalog, Entitlements, and Metering, design handlers to be idempotent - reprocessing an inbound event (e.g. tenant-activated, quota-exceeded) must not double-provision or double-cancel.
Write serialization¶
SubscriptionEditorGrain (keyed by tenant id) serializes concurrent writes per tenant, protecting the one-subscription-per-tenant invariant under concurrent commands and saga reactions.