TsgcWSPServer_WAMPイベント › OnBeforeCancelCall

OnBeforeCancelCall イベント

クライアントが進行中の RPC のキャンセルを要求したときに発生し、サーバーがリクエストを承認または拒否する機会を提供します。

構文

property OnBeforeCancelCall: TsgcWSBeforeCancelCallEvent;
// TsgcWSBeforeCancelCallEvent = procedure(Connection: TsgcWSConnection; const CallId: string; var Cancel: Boolean) of object

デフォルト値

解説

CallIdで識別される、以前にディスパッチされたCALLに対してCALLCANCELフレームが到着したときに発生します。CancelはデフォルトでTrueであり、これはブローカーにその呼び出しの進捗結果の配信を停止し、アプリケーションからの終端のCallErrorを期待するよう伝えます。キャンセルを拒否するにはCancelFalseに設定します。RPCは実行を継続し、その最終的なCallResultまたはCallErrorは引き続き返されます。一般的な用途は、長時間実行されるクエリ、バッチジョブ、または呼び出し元が気を変えたバックグラウンドRPCです。

使用例


procedure TForm1.WAMPServerBeforeCancelCall(Connection: TsgcWSConnection;
  const CallId: string; var Cancel: Boolean);
begin
  // honour the cancel and respond with an error so the caller resolves
  Cancel := True;
  WSPServerWAMP1.CallError(Connection, CallId,
    'http://example.com/errors/cancelled', 'call cancelled by client');
end;

イベントに戻る