QGrpcInitialMetadataInterceptor Class | Qt GRPC | Qt 6.12.0
Description: Intercepts initial metadata for an RPC.
Keywords: class

- Qt 6.12
- Qt GRPC
- C++ Classes
- QGrpcInitialMetadataInterceptor
- Qt 6.12.0 Reference Documentation

# QGrpcInitialMetadataInterceptor Class

Intercepts initial metadata 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

- List of all members, including inherited members
- QGrpcInitialMetadataInterceptor is part of Qt GRPC Interceptors.

Note: All functions in this class are reentrant.

## Public Functions

virtual | ~QGrpcInitialMetadataInterceptor()
virtual void | onInitialMetadata(QGrpcInterceptionContext &context, QMultiHash<QByteArray, QByteArray> &metadata) = 0

## Detailed Description

Implement QGrpcInitialMetadataInterceptor to observe or modify initial metadata associated with an RPC.

Initial metadata is sent by the server immediately after the call is established and before any response messages are delivered.

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::InitialMetadata, QGrpcOperation::serverInitialMetadata(), QGrpcOperation::serverInitialMetadataReceived(), and QGrpcInterceptionContext.

## Member Function Documentation

### `[virtual noexcept]` QGrpcInitialMetadataInterceptor::~QGrpcInitialMetadataInterceptor()

Destroys the interceptor.

### `[pure virtual]` void QGrpcInitialMetadataInterceptor::onInitialMetadata(QGrpcInterceptionContext &context, QMultiHash<QByteArray, QByteArray> &metadata)

Called when the initial metadata becomes available for the RPC.

The context provides information about the intercepted RPC. The metadata can be modified in place before it is forwarded to the RPC.

See also QGrpcOperation::serverInitialMetadata() and QGrpcOperation::serverInitialMetadataReceived().