TsgcWSPClient_STOMP_RabbitMQProperties › HeartBeat

HeartBeat Property

Negotiates the STOMP 1.1/1.2 heart-beat header so the client and RabbitMQ exchange keep-alive newlines and detect silent drops.

Syntax

property HeartBeat: TsgcWSSTOMPHeartBeat_Options read FHeartBeat write SetHeartBeat;

Default Value

Enabled=True, Incoming=0, Outgoing=0

Remarks

Heartbeat is enabled by default but only takes effect when the negotiated protocol is STOMP 1.1 or 1.2 (heart-beat is not defined in 1.0). Outgoing is the minimum interval in milliseconds at which the client guarantees to send data to the broker; Incoming is the smallest interval the client is willing to accept from the broker. Both values are emitted in the CONNECT frame as heart-beat: <Outgoing>,<Incoming> and RabbitMQ returns its own pair in CONNECTED; the effective intervals are the pairwise maximums. A value of 0 disables that direction. When no other frame has been written within Outgoing ms the client sends a single newline (0x0A) as the STOMP heartbeat, which fires OnRabbitMQPing in sgcstmpOutgoingPing mode; inbound newlines fire it in sgcstmpIncomingPing mode. When a TsgcWebSocketClient is attached to the Web-STOMP plugin, setting HeartBeat.Enabled := True also mirrors Outgoing (converted to seconds) onto the WebSocket-level HeartBeat.Interval so the ping fires from the WebSocket timer.

Example


oRabbit := TsgcWSPClient_STOMP_RabbitMQ.Create(nil);
oRabbit.HeartBeat.Enabled := True;
oRabbit.HeartBeat.Outgoing := 10000;
oRabbit.HeartBeat.Incoming := 10000;

Back to Properties