TsgcWSCircuitBreakerMethods › RecordMessageSuccess

RecordMessageSuccess Method

Server-side hook that records a successful message on ServerKey.

Syntax

procedure RecordMessageSuccess(const aIP: string);

Parameters

NameTypeDescription
aIPconst stringPeer IP address of the connection that delivered the message. Accepted for logging and future per-IP metrics; the actual accounting goes against ServerKey.

Remarks

WebSocket-message flavored success recorder for server-side self-protection. Delegates to RecordSuccess(ServerKey) — the IP parameter is currently informational and is used by future per-IP metrics. Call from the server's OnMessage handler after the message has been processed successfully so the breaker can evaluate its HalfOpen -> Closed transition if the server was recovering. Returns immediately when Enabled is False.

Example

procedure TForm1.WSServerMessage(Connection: TsgcWSConnection;
  const Text: string);
begin
  try
    HandleMessage(Text);
    sgcWSCircuitBreaker1.RecordMessageSuccess(Connection.PeerIP);
  except
    on E: Exception do
      sgcWSCircuitBreaker1.RecordMessageError(Connection.PeerIP, E.Message);
  end;
end;

Back to Methods