TsgcWSPClient_MQTTOlaylar › OnMQTTPubRec

OnMQTTPubRec Olay

QoS 2 handshake'inin ikinci ayağında tetiklenir (PUBLISH → PUBREC → PUBREL → PUBCOMP).

Sözdizimi

property OnMQTTPubRec: TsgcWSMQTTPubRecEvent;
// TsgcWSMQTTPubRecEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; ReasonCode: Integer; const ReasonName: String; PubRecProperties: TsgcWSMQTTPUBRECProperties) of object

Varsayılan Değer

Remarks

QoS 2, dört paketli bir handshake aracılığıyla tam-bir-kez (exactly-once) teslimatı garanti eder: PUBLISH → PUBREC → PUBREL → PUBCOMP. OnMQTTPubRec, broker orijinal PUBLISH'i bir PUBREC paketiyle onayladığında tetiklenir ve broker'ın mesajı tam-bir-kez akışı için kabul ettiğini bildirir. Bileşen, handshake'e devam etmek için otomatik olarak PUBREL ile yanıt verir; nihai PUBCOMP, OnMQTTPubComp'ta gelecektir. Parametreler:

Örnek

procedure TForm1.MQTTPubRec(Connection: TsgcWSConnection;
  aPacketIdentifier: Word; ReasonCode: Integer;
  const ReasonName: String;
  PubRecProperties: TsgcWSMQTTPUBRECProperties);
begin
  // second leg of QoS 2: broker has the message, PUBREL is sent automatically
  Memo1.Lines.Add(Format('PUBREC id=%d (%s)',
    [aPacketIdentifier, ReasonName]));
end;

Olaylara Dön