本页内容

QGrpcCancelInterceptor Class

拦截针对某个 RPC 的取消请求。更多...

标题: #include <QGrpcInterceptor>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
自: Qt 6.11

注意:该类中的所有函数均为可重入的。

公共函数

virtual ~QGrpcCancelInterceptor()
virtual void onCancel(QGrpcInterceptionContext &context) = 0

详细说明

实现 QGrpcCancelInterceptor 以监听 RPC 何时被请求取消。

有关拦截机制以及拦截器接口如何参与 RPC 生命周期的介绍,请参阅《Qt GRPC 拦截器概述》。

注意:此 拦截器在入站方向上运行。有关多个拦截器回调如何流经链的详细信息,请参阅“方向和流”部分。

另请参阅 QtGrpc::InterceptorCapability::Cancel 和QGrpcInterceptionContext 。

成员函数文档

[virtual noexcept] QGrpcCancelInterceptor::~QGrpcCancelInterceptor()

摧毁了这架拦截机。

[pure virtual] void QGrpcCancelInterceptor::onCancel(QGrpcInterceptionContext &context)

当请求取消 RPC 时调用此方法。

context 提供了有关被拦截的 RPC 的信息。

另请参阅 QGrpcOperation::cancel()。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.