本页内容

QGrpcTrailingMetadataInterceptor Class

拦截 RPC 的尾部元数据。更多内容...

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

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

公共函数

virtual ~QGrpcTrailingMetadataInterceptor()
virtual void onTrailingMetadata(QGrpcInterceptionContext &context, QMultiHash<QByteArray, QByteArray> &metadata) = 0

详细说明

实现 QGrpcTrailingMetadataInterceptor 以观察或修改与 RPC 相关的尾部元数据。

尾随元数据由服务器在 RPC 完成时发送,即在所有响应消息都已传递之后。

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

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

另请参阅 QtGrpc::InterceptorCapability::TrailingMetadata 、QGrpcOperation::serverTrailingMetadata() 和QGrpcInterceptionContext 。

成员函数文档

[virtual noexcept] QGrpcTrailingMetadataInterceptor::~QGrpcTrailingMetadataInterceptor()

摧毁了那架拦截机。

[pure virtual] void QGrpcTrailingMetadataInterceptor::onTrailingMetadata(QGrpcInterceptionContext &context, QMultiHash<QByteArray, QByteArray> &metadata)

当 RPC 的尾随metadata 可用时调用。

context 提供了有关被拦截的 RPC 的信息。在将metadata 转发给 RPC 之前,可以就地对其进行修改。

另请参阅 QGrpcOperation::serverTrailingMetadata()。

© 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.