QGrpcClientInterceptorManager Class

Manages QGrpcClientInterceptor interceptors. More...

Header: #include <QGrpcClientInterceptorManager>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.7
Status: Technical Preview

Public Functions

void registerInterceptor(std::shared_ptr<QGrpcClientInterceptor> next)
void registerInterceptors(std::vector<std::shared_ptr<QGrpcClientInterceptor>> nextInterceptors)
void run(QGrpcInterceptorContinuation<T> &finalCall, typename QGrpcInterceptorContinuation<T>::ReplyType response, std::shared_ptr<QGrpcChannelOperation> operation, size_t pos = 0)

Detailed Description

The QGrpcClientInterceptorManager class provides methods for registering and executing QGrpcClientInterceptor interceptors.

See also Qt GRPC Client Interceptors.

Member Function Documentation


The default constructor, creates QGrpcClientInterceptorManager object.

[noexcept] QGrpcClientInterceptorManager::~QGrpcClientInterceptorManager()

The default destructor, destroyes QGrpcClientInterceptorManager object.

void QGrpcClientInterceptorManager::registerInterceptor(std::shared_ptr<QGrpcClientInterceptor> next)

Registers a QGrpcClientInterceptor interceptor.

Places the next interceptor at the beginning of the interceptor chain. Interceptors are executed in reverse order of registration. For instance,


will result in:

myInterceptor2 -> myInterceptor1 -> Qt GRPC operation

order of execution.

void QGrpcClientInterceptorManager::registerInterceptors(std::vector<std::shared_ptr<QGrpcClientInterceptor>> nextInterceptors)

Registers multiple QGrpcClientInterceptor interceptors.

Adds the given interceptors to the start of the interceptor chain. While execution occurs in the reverse order of registration, the original order in the nextInterceptors vector is maintained, for example:

manager.registerInterceptors({myInterceptor2, myInterceptor3});

will result in:

myInterceptor2 -> myInterceptor3 -> myInterceptor1 -> Qt GRPC operation

order of execution.

template <typename T> void QGrpcClientInterceptorManager::run(QGrpcInterceptorContinuation<T> &finalCall, typename QGrpcInterceptorContinuation<T>::ReplyType response, std::shared_ptr<QGrpcChannelOperation> operation, size_t pos = 0)

Executes the Qt GRPC interceptors in the chain for a specific QGrpcOperation type.

The process initiates with the interceptor located at position pos in the QGrpcClientInterceptor chain. Both response and operation parameters are relayed to the QGrpcClientInterceptor::intercept() method. Upon reaching the end of the interceptor chain, the finalCall is invoked.

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