TsgcWebSocketLoadBalancerServerEvents › OnServerReady

OnServerReady Event

Fires when a backend server has finished registering with the load balancer and is ready to accept traffic.

Syntax

property OnServerReady: TsgcWSLBServerReadyEvent;
// TsgcWSLBServerReadyEvent = procedure(Server: TsgcWSLBServerConnection) of object

Default Value

Remarks

OnServerReady is raised after a backend has connected (see OnServerConnect) and successfully announced its Guid and Bindings to the load balancer. From this moment on the backend is part of the routing pool and the configured LoadBalancing algorithm (lbRandom or lbConnections) can pick it for new client sessions. The Server parameter is the TsgcWSLBServerConnection wrapper which exposes the backend Guid, its list of public Bindings and connection statistics, so the event is the ideal place to log the effective pool size or to push the addition to an external discovery service.

Example


procedure OnServerReady(Server: TsgcWSLBServerConnection);
begin
  Log(Format('Backend ready: %s with %d binding(s)',
    [Server.Guid, Server.Bindings.Count]));
end;

Back to Events