本页内容

QGrpcWriteMessageInterceptor Class

拦截为 RPC 编写的传出消息。更多...

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

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

公共函数

virtual ~QGrpcWriteMessageInterceptor()
virtual void onWriteMessage(QGrpcInterceptionContext &context, QProtobufMessage &message) = 0

详细说明

实现 QGrpcWriteMessageInterceptor 以监视或修改在 RPC 启动后作为其一部分写入的消息。

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

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

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

成员函数文档

[virtual noexcept] QGrpcWriteMessageInterceptor::~QGrpcWriteMessageInterceptor()

摧毁了这架截击机。

[pure virtual] void QGrpcWriteMessageInterceptor::onWriteMessage(QGrpcInterceptionContext &context, QProtobufMessage &message)

当即将为 RPC 写入出站message 时调用此方法。

该context 提供了有关被拦截的RPC的信息。message 可以就地修改。

另请参阅 QGrpcClientStream::writeMessage() 和QGrpcBidiStream::writeMessage()。

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