QGrpcStartInterceptor Class | Qt GRPC | Qt 6.11.1
Description: Intercepts the start of an RPC.

- Qt 6.11
- Qt GRPC
- C++ Classes
- QGrpcStartInterceptor
- Qt 6.11.1 Reference Documentation

# QGrpcStartInterceptor Class

Intercepts the start of 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
- QGrpcStartInterceptor is part of Qt GRPC Interceptors.

Note: All functions in this class are reentrant.

## Public Types

`(since 6.11)` enum class | Continuation { Proceed, Drop }

## Public Functions

virtual | ~QGrpcStartInterceptor()
virtual QGrpcStartInterceptor::Continuation | onStart(QGrpcInterceptionContext &context, QProtobufMessage &message, QGrpcCallOptions &callOptions) = 0

## Detailed Description

Implement QGrpcStartInterceptor to observe or adjust parameters that are used when an RPC is started.

The interceptor is invoked once per RPC, before the call proceeds.

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::Start and QGrpcInterceptionContext.

## Member Type Documentation

### `[since 6.11]` enum class QGrpcStartInterceptor::Continuation

Controls whether an intercepted RPC should proceed.

Constant | Value | Description
--- | --- | ---
`QGrpcStartInterceptor::Continuation::Proceed` | `0` | Continue the call.
`QGrpcStartInterceptor::Continuation::Drop` | `1` | Abort the call.

This enum was introduced in Qt 6.11.

## Member Function Documentation

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

Destroys the interceptor.

### `[pure virtual]` QGrpcStartInterceptor::Continuation QGrpcStartInterceptor::onStart(QGrpcInterceptionContext &context, QProtobufMessage &message, QGrpcCallOptions &callOptions)

Called when an RPC is about to start.

The context provides information about the intercepted RPC.

The message contains the initial request message and can be modified in place.

The callOptions can be modified to adjust per-call settings.

Return Continuation::Proceed to continue the RPC, or Continuation::Drop to prevent it from proceeding.

If Continuation::Drop is returned, the RPC is aborted and the operation transitions to finished(). The resulting status code is Aborted. Interceptors implementing QGrpcFinishedInterceptor are still invoked.

Note: The mutable callOptions refers to the same call options instance returned by `context.callOptions()`.