TsgcWSPClient_MQTTイベント › OnMQTTPubComp

OnMQTTPubComp イベント

PUBCOMP を受信したときに、QoS 2 ハンドシェイクの第4の最終段階で発生します。

構文

property OnMQTTPubComp: TsgcWSMQTTPubCompEvent;
// TsgcWSMQTTPubCompEvent = procedure(Connection: TsgcWSConnection; aPacketIdentifier: Word; ReasonCode: Integer; const ReasonName: String; PubCompProperties: TsgcWSMQTTPUBCOMPProperties) of object

デフォルト値

解説

ブローカーが PUBCOMP を送信したとき (QoS 2 ハンドシェイク PUBLISH → PUBREC → PUBREL → PUBCOMP の 4 番目かつ最後のパケット) に発生します。この時点でちょうど一度の配信が完全に完了し、パケット識別子を再利用できます。パラメータ:

これは QoS 2 のパブリッシュがエンドツーエンドで完全に処理されたことを確認する必要があるときに監視するイベントです。

使用例

procedure TForm1.MQTTPubComp(Connection: TsgcWSConnection;
  aPacketIdentifier: Word; ReasonCode: Integer;
  const ReasonName: String;
  PubCompProperties: TsgcWSMQTTPUBCOMPProperties);
begin
  // QoS 2 delivery is now complete
  Memo1.Lines.Add(Format('PUBCOMP id=%d delivered exactly-once',
    [aPacketIdentifier]));
end;

イベントに戻る