QGrpcMessageReceivedInterceptor Class

Intercepts incoming message payloads for an RPC. More...

Header: #include <QGrpcInterceptor>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.11

Note: All functions in this class are reentrant.

Public Functions

virtual ~QGrpcMessageReceivedInterceptor()
virtual void onMessageReceived(QGrpcInterceptionContext &context, QByteArray &messageData) = 0

Detailed Description

Implement QGrpcMessageReceivedInterceptor to observe or modify the serialized message payload of messages received from an RPC.

For an introduction to the interception mechanism and how interceptor interfaces participate in the lifecycle of an RPC, see the Qt GRPC Interceptors Overview.

Note: This interceptor operates in the outbound direction. For details on how multiple interceptor callbacks flow through the chain, see the Direction and flow section.

See also QtGrpc::InterceptorCapability::MessageReceived and QGrpcInterceptionContext.

Member Function Documentation

[virtual noexcept] QGrpcMessageReceivedInterceptor::~QGrpcMessageReceivedInterceptor()

Destroys the interceptor.

[pure virtual] void QGrpcMessageReceivedInterceptor::onMessageReceived(QGrpcInterceptionContext &context, QByteArray &messageData)

Called when an incoming message payload messageData becomes available.

The context provides information about the intercepted RPC. The messageData contains serialized message bytes and can be modified in place.

See also QGrpcServerStream::messageReceived() and QGrpcBidiStream::messageReceived().