Deduplication engine for billing webhook events.
Supports two strategies:
:memory(default) - High-performance in-memory ETS table with hourly TTL cleanup. Best for single-node deployments and local development.:resource- Database-backed Ash resource deduplication with unique constraint enforcement. Guarantees cross-node deduplication across clustered environments (e.g. Fly.io, Kubernetes, ECS).
Configuration
Via application config:
config :ash_billing,
deduplication_strategy: :resource,
deduplication_resource: MyApp.Billing.WebhookEventOr per-Plug in Phoenix Router:
forward "/webhooks/stripe", AshBilling.Plug,
deduplication_resource: MyApp.Billing.WebhookEvent,
domain: MyApp.Billing
Summary
Functions
Returns a specification to start this module under a supervisor.
Clears all tracked events in memory (useful in tests).
Marks an event ID as processed.
Checks if an event ID has already been processed.
Starts the deduplication server and initializes the ETS table for memory strategy.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec clear() :: :ok
Clears all tracked events in memory (useful in tests).
Marks an event ID as processed.
Checks if an event ID has already been processed.
Starts the deduplication server and initializes the ETS table for memory strategy.