TsgcWSPServer_WAMP事件 › OnBeforeCancelCall

OnBeforeCancelCall 事件

当客户端请求取消正在进行的 RPC 时触发,服务器有机会接受或拒绝该请求。

语法

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

默认值

备注

当 CALLCANCEL 帧到达,用于之前由 CallId 标识的已分发 CALL 时引发。默认情况下 CancelTrue,这告知代理停止为该调用传递渐进式结果,并期待来自应用程序的终止 CallError。将 Cancel 设置为 False 以拒绝取消——RPC 将继续运行,其最终的 CallResultCallError 仍将发回。典型用途是长时间运行的查询、批处理作业或调用者改变主意的后台 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;

返回事件