Circuit Breaker — sgcWebSockets | eSeGeCe

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

Closed / Open / Half-Open circuit-breaker for HTTP API calls. Short-circuits requests when an upstream becomes unhealthy, so your app fails fast.

Component class

TsgcWSCircuitBreaker

Protocol

Client-side resilience — attaches to any sgc HTTP / AI / API component that exposes a CircuitBreaker property.

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop the component, set a few properties, go

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;

What's inside

10 published properties, 17 methods, 5 events — pulled from the component reference.

Configuration

Published properties: Thresholds, TimeWindow, Recovery.

Diagnostics

Published properties: Metrics.

Core

Properties: Enabled, DefaultKey, ServerKey.

Execution

Methods: Execute, ExecuteWithResult, IsCallAllowed.

Recording

Methods: RecordSuccess, RecordFailure, RecordMessageSuccess.

Integration

Methods: IsConnectionAllowed, IsMessageAllowed, RegisterConnection.

Documentation & Demos

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.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Stop Cascading Failures Today

Download the free trial and add the Circuit Breaker pattern to your sgcWebSockets HTTP API clients.