How do you handle errors in integrations? Explain idempotency, retry with exponential backoff, and the circuit breaker pattern.
Suggested answer
Idempotency: An operation is idempotent if performing it multiple times produces the same result as performing it once. For integrations, use idempotency keys (a unique transaction ID included in each request). The receiving system uses this key to detect and ignore duplicate requests. This is critical when retries may cause duplicate records or payments.
Retry with Exponential Backoff: On transient failures (HTTP 429, 503, 504), retry the request with increasing wait intervals (e.g., 1s, 2s, 4s, 8s…) plus random jitter to prevent thundering herd. Cap the maximum retry count and total wait time. In Salesforce, implement via Queueable chaining with a retry counter stored in the job state.
Circuit Breaker Pattern: Prevents cascading failures by "opening" the circuit after a threshold of consecutive failures. In OPEN state, requests fail fast without attempting the external call. After a cooldown period, the circuit moves to HALF-OPEN — one test request is allowed. If it succeeds, the circuit closes. Implement in Salesforce using Custom Metadata or Cache to track failure counts and circuit state.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.