TsgcWSPClient_STOMP_RabbitMQEvents › OnRabbitMQConnected

OnRabbitMQConnected Event

Fires after the RabbitMQ broker answers the CONNECT frame with a CONNECTED frame; exposes the negotiated session via a typed Headers object.

Syntax

property OnRabbitMQConnected: TsgcWSRabbitMQSTOMPConnectedEvent;
// TsgcWSRabbitMQSTOMPConnectedEvent = procedure(Connection: TsgcWSConnection; Headers: TsgcWSRabbitMQSTOMPHeadersConnected) of object

Default Value

Remarks

Raised when RabbitMQ answers the CONNECT / STOMP frame with a CONNECTED frame. This is the first moment at which the STOMP session is fully usable — it is safe to call Subscribe / Send / BeginTransaction from inside this handler. Parameters:

Example

procedure TForm1.RabbitMQConnected(Connection: TsgcWSConnection;
  Headers: TsgcWSRabbitMQSTOMPHeadersConnected);
begin
  Memo1.Lines.Add(Format('RabbitMQ %s connected to %s (session=%s, heart-beat=%s)',
    [Headers.Version, Headers.Server, Headers.Session, Headers.HeartBeat]));

  // now it is safe to subscribe
  RabbitMQ.SubscribeQueue('orders');
end;

Back to Events