Circuit Breaker
TsgcWSCircuitBreaker — the Circuit Breaker resilience pattern for client-side calls to HTTP APIs. Stop sending requests to a failing upstream the moment it goes down: fail fast, recover gracefully and let the remote service breathe.
TsgcWSCircuitBreaker — the Circuit Breaker resilience pattern for client-side calls to HTTP APIs. Stop sending requests to a failing upstream the moment it goes down: fail fast, recover gracefully and let the remote service breathe.
Closed / Open / Half-Open circuit-breaker for HTTP API calls. Short-circuits requests when an upstream becomes unhealthy, so your app fails fast.
TsgcWSCircuitBreaker
Client-side resilience — attaches to any sgc HTTP / AI / API component that exposes a CircuitBreaker property.
Windows, macOS, Linux, iOS, Android
Standard / Professional / Enterprise
Set thresholds, hook the three lifecycle events, then attach the breaker to any HTTP component.
uses
sgcCircuitBreaker;
var
CB: TsgcWSCircuitBreaker;
begin
CB := TsgcWSCircuitBreaker.Create(nil);
CB.FailureThreshold := 5;
CB.ResetTimeout := 30; // seconds
CB.OnCircuitBreakerOpen := DoOpen;
CB.OnCircuitBreakerHalfOpen := DoHalfOpen;
CB.OnCircuitBreakerClose := DoClose;
// Attach to an HTTP / API component that exposes a CircuitBreaker property
Anthropic.CircuitBreaker := CB;
end;
10 published properties, 17 methods, 5 events — pulled from the component reference.
Published properties: Thresholds, TimeWindow, Recovery.
Published properties: Metrics.
Properties: Enabled, DefaultKey, ServerKey.
Methods: Execute, ExecuteWithResult, IsCallAllowed.
Methods: RecordSuccess, RecordFailure, RecordMessageSuccess.
Methods: IsConnectionAllowed, IsMessageAllowed, RegisterConnection.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Demo Project — 01.WebSocket\08.CircuitBreaker Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |