Skip to main content

Resilience: what happens when things fail

FailureBehaviourCaller sees
AvaTax slow or down (timeout, 5xx, 429, circuit open)Estimates fail fast. Documents stay PendingTax, and tax-pending-recalculation retries them with exponential back-off per document.Estimate: 503 with fallback: "manual". Document: 202 + TaxCalculationDeferred.
AvaTax rejects the dataDocument Failed, no retry422 provider_rejected with AvaTax's code and details, plus TaxCalculationFailed
AvaTax credentials wrong (401/403)Treated as unavailable (it's fixable without new data)As above. Shows up as StalePending after 24 h.
RabbitMQ downOutbox rows wait in Postgres and are delivered when the broker returns. API pods stay ready.Nothing; REST keeps working. /health/bus reports 503.
Message can't be handled yet (original not received or not committed, concurrent update, AvaTax down)Parked in deferred_messages, redelivered after 1 m, 5 m, 15 m, 1 h, 4 h, then _error (ADR 0008)Nothing, unless it still fails after ~5½ h
Consumer fails unexpectedly (connection drop, timeout)Retried 5 times right away with exponential back-off (1 s to 2 min)Nothing
Consumer gets bad dataNot retried. The message goes to the _error queue and a Fault<T> names the invalid fields.Fix the sender and move the message back
Bank of Canada downThe latest stored rate on or before the date is used, for up to 7 days503 provider_unavailable beyond that
Pod dies mid-jobAdvisory lock released with the connection; another replica runs it at its next poll (it is still due in job_runs)Nothing

Readiness depends only on the database. AvaTax and RabbitMQ problems degrade features; they never take pods out of rotation. /health/providers (AvaTax) and /health/bus (RabbitMQ) report them separately. A test stops the broker and checks that /health/ready stays 200.

The AvaTax HTTP client uses Microsoft.Extensions.Http.Resilience (attempt timeout, retries with jitter, circuit breaker, and a total timeout from AvaTax__TotalTimeout).