import{jsx as e,jsxs as r}from"react/jsx-runtime";function t(){return r("div",{className:"space-y-8",children:[r("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"Integration Circuit Breakers"}),e("p",{className:"text-lg text-muted-foreground",children:"External APIs are the most common source of instability. Wrap every integration call in a circuit breaker to protect your system."})]}),r("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Pattern"}),e("p",{children:"Create a dedicated circuit breaker instance for each external service. This ensures that a failure in Stripe doesn't trigger the circuit breaker for Twilio."}),e("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`// integrations/stripe.ts
import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';

const stripeBreaker = new CircuitBreaker({
  failureThreshold: 10,
  resetTimeoutMs: 60000,
});

export async function createCharge(amount: number) {
  return stripeBreaker.execute(() => stripe.charges.create({ amount }));
}`})]})]})}export{t as IntegrationsCircuitBreakersPage};
