Your banking app is only as fast as the slowest service it calls.
A customer applies for an instant loan in your mobile banking app. Behind the scenes, the app calls the Credit Bureau API to check their score.
One morning, that API starts timing out.
Without protection, every loan request waits 30 seconds for a timeout. Requests pile up, server threads get stuck, and soon even the balance screen feels slow. One failing partner has slowed down your whole bank.
The pattern
The Circuit Breaker pattern prevents this. It works like the breaker in your home's electrical panel: it trips and cuts off a failing line before the problem spreads.
It has three states:
- 🟢 CLOSED: Everything is healthy. Calls go through and failures are counted.
- 🔴 OPEN: Failures reach a threshold (say 5 in a row). The breaker trips, calls are blocked, and a fallback answers immediately.
- 🟡 HALF-OPEN: After a cooldown (say 60 seconds), one trial call is allowed. Success closes the breaker. Failure opens it again.
Back to the loan example
When the Credit Bureau is down:
- The breaker opens after 5 failures
- The customer gets an instant answer: "Application saved. Your credit check is pending and we'll notify you."
- The application is stored as "Pending credit check" and a Timer retries later
- Nobody waits for timeouts, and the rest of the app stays fast
How I built it in OutSystems
As a reusable library:
- One entity row per external service: state, failure count, last failure time, threshold and cooldown
- Three public server actions (below)
- Site properties for the default threshold and cooldown, tunable per environment without a code change
- A log table for every state change, ready for dashboards and alerts
- A daily Timer that purges old log rows
In the consumer flow: Evaluate → if allowed, call the REST API → RecordSuccess. Not allowed → fallback. Exception handler → RecordFailure → fallback.
Where to use it in a bank
Credit Bureau, payment gateways, SMS/OTP providers, FX rate feeds and KYC/AML screening.
A circuit breaker doesn't fix the failing service. It protects everything else from it.
What's Inside the Solution File
The solution consists of two modules: a reusable circuit breaker framework built for OutSystems, and a demo application that shows how to apply it in a real-world integration.
Solution files
Everything used on this page, ready to download.