Back to feed
Dev.to
Dev.to
6/24/2026
Billing asynchronous work exactly once

Billing asynchronous work exactly once

Short summary

Billing async work requires firing meters exactly once per successful completion. Combine a durable transactional outbox (at-least-once delivery) with an idempotent sink (deduplicates retries) to achieve exactly-once billing. Handle partial failures and retries by metering only on success, avoiding both underbilling and double-charging.

  • Async billing breaks the synchronous pattern—meter at work completion, not arrival or retrieval
  • Use transactional outbox plus idempotent sink to guarantee exactly-once billing across retries and polling
  • Distinguish successful completion from terminal state and handle partial failures by metering at the granularity where output has value

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more