Class Interceptor (2.48.0)

public abstract class Interceptor : object

Serves as the base class for gRPC interceptors.

Inheritance

Object > Interceptor

Namespace

Grpc.Core.Interceptors

Assembly

Grpc.Core.Api.dll

Methods

AsyncClientStreamingCall<TRequest, TResponse>(ClientInterceptorContext<TRequest, TResponse>, Interceptor.AsyncClientStreamingCallContinuation<TRequest, TResponse>)

public virtual AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(ClientInterceptorContext<TRequest, TResponse> context, Interceptor.AsyncClientStreamingCallContinuation<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Intercepts an asynchronous invocation of a client streaming call.

Parameters
Name Description
context ClientInterceptorContext<TRequest, TResponse>

The ClientInterceptorContext<TRequest, TResponse> associated with the current invocation.

continuation Interceptor.AsyncClientStreamingCallContinuation<TRequest, TResponse>

The callback that continues the invocation process. This can be invoked zero or more times by the interceptor. The interceptor can invoke the continuation passing the given context argument, or substitute as it sees fit.

Returns
Type Description
AsyncClientStreamingCall<TRequest, TResponse>

An instance of AsyncClientStreamingCall<TRequest, TResponse> representing an asynchronous client-streaming invocation. The interceptor can simply return the return value of the continuation delegate passed to it intact, or construct its own substitute as it sees fit.

Type Parameters
Name Description
TRequest
TResponse

AsyncDuplexStreamingCall<TRequest, TResponse>(ClientInterceptorContext<TRequest, TResponse>, Interceptor.AsyncDuplexStreamingCallContinuation<TRequest, TResponse>)

public virtual AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(ClientInterceptorContext<TRequest, TResponse> context, Interceptor.AsyncDuplexStreamingCallContinuation<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Intercepts an asynchronous invocation of a duplex streaming call.

Parameters
Name Description
context ClientInterceptorContext<TRequest, TResponse>

The ClientInterceptorContext<TRequest, TResponse> associated with the current invocation.

continuation Interceptor.AsyncDuplexStreamingCallContinuation<TRequest, TResponse>

The callback that continues the invocation process. This can be invoked zero or more times by the interceptor. The interceptor can invoke the continuation passing the given context argument, or substitute as it sees fit.

Returns
Type Description
AsyncDuplexStreamingCall<TRequest, TResponse>

An instance of AsyncDuplexStreamingCall<TRequest, TResponse> representing an asynchronous duplex-streaming invocation. The interceptor can simply return the return value of the continuation delegate passed to it intact, or construct its own substitute as it sees fit.

Type Parameters
Name Description
TRequest
TResponse

AsyncServerStreamingCall<TRequest, TResponse>(TRequest, ClientInterceptorContext<TRequest, TResponse>, Interceptor.AsyncServerStreamingCallContinuation<TRequest, TResponse>)

public virtual AsyncServerStreamingCall<TResponse> AsyncServerStreamingCall<TRequest, TResponse>(TRequest request, ClientInterceptorContext<TRequest, TResponse> context, Interceptor.AsyncServerStreamingCallContinuation<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Intercepts an asynchronous invocation of a streaming remote call.

Parameters
Name Description
request TRequest

The request message of the invocation.

context ClientInterceptorContext<TRequest, TResponse>

The ClientInterceptorContext<TRequest, TResponse> associated with the current invocation.

continuation Interceptor.AsyncServerStreamingCallContinuation<TRequest, TResponse>

The callback that continues the invocation process. This can be invoked zero or more times by the interceptor. The interceptor can invoke the continuation passing the given request value and context arguments, or substitute them as it sees fit.

Returns
Type Description
AsyncServerStreamingCall<TResponse>

An instance of AsyncServerStreamingCall<TResponse> representing an asynchronous server-streaming invocation. The interceptor can simply return the return value of the continuation delegate passed to it intact, or construct its own substitute as it sees fit.

Type Parameters
Name Description
TRequest
TResponse

AsyncUnaryCall<TRequest, TResponse>(TRequest, ClientInterceptorContext<TRequest, TResponse>, Interceptor.AsyncUnaryCallContinuation<TRequest, TResponse>)

public virtual AsyncUnaryCall<TResponse> AsyncUnaryCall<TRequest, TResponse>(TRequest request, ClientInterceptorContext<TRequest, TResponse> context, Interceptor.AsyncUnaryCallContinuation<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Intercepts an asynchronous invocation of a simple remote call.

Parameters
Name Description
request TRequest

The request message of the invocation.

context ClientInterceptorContext<TRequest, TResponse>

The ClientInterceptorContext<TRequest, TResponse> associated with the current invocation.

continuation Interceptor.AsyncUnaryCallContinuation<TRequest, TResponse>

The callback that continues the invocation process. This can be invoked zero or more times by the interceptor. The interceptor can invoke the continuation passing the given request value and context arguments, or substitute them as it sees fit.

Returns
Type Description
AsyncUnaryCall<TResponse>

An instance of AsyncUnaryCall<TResponse> representing an asynchronous unary invocation. The interceptor can simply return the return value of the continuation delegate passed to it intact, or construct its own substitute as it sees fit.

Type Parameters
Name Description
TRequest
TResponse

BlockingUnaryCall<TRequest, TResponse>(TRequest, ClientInterceptorContext<TRequest, TResponse>, Interceptor.BlockingUnaryCallContinuation<TRequest, TResponse>)

public virtual TResponse BlockingUnaryCall<TRequest, TResponse>(TRequest request, ClientInterceptorContext<TRequest, TResponse> context, Interceptor.BlockingUnaryCallContinuation<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Intercepts a blocking invocation of a simple remote call.

Parameters
Name Description
request TRequest

The request message of the invocation.

context ClientInterceptorContext<TRequest, TResponse>

The ClientInterceptorContext<TRequest, TResponse> associated with the current invocation.

continuation Interceptor.BlockingUnaryCallContinuation<TRequest, TResponse>

The callback that continues the invocation process. This can be invoked zero or more times by the interceptor. The interceptor can invoke the continuation passing the given request value and context arguments, or substitute them as it sees fit.

Returns
Type Description
TResponse

The response message of the current invocation. The interceptor can simply return the return value of the continuation delegate passed to it intact, or an arbitrary value as it sees fit.

Type Parameters
Name Description
TRequest
TResponse

ClientStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest>, ServerCallContext, ClientStreamingServerMethod<TRequest, TResponse>)

public virtual Task<TResponse> ClientStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest> requestStream, ServerCallContext context, ClientStreamingServerMethod<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Server-side handler for intercepting client streaming call.

Parameters
Name Description
requestStream IAsyncStreamReader<TRequest>

The request stream of the incoming invocation.

context ServerCallContext

An instance of ServerCallContext representing the context of the invocation.

continuation ClientStreamingServerMethod<TRequest, TResponse>

A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and return the response value of the RPC. The interceptor can choose to call it zero or more times at its discretion.

Returns
Type Description
Task<TResponse>

A future representing the response value of the RPC. The interceptor can simply return the return value from the continuation intact, or an arbitrary response value as it sees fit. The interceptor has the ability to wrap or substitute the request stream when calling the continuation.

Type Parameters
Name Description
TRequest

Request message type for this method.

TResponse

Response message type for this method.

DuplexStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest>, IServerStreamWriter<TResponse>, ServerCallContext, DuplexStreamingServerMethod<TRequest, TResponse>)

public virtual Task DuplexStreamingServerHandler<TRequest, TResponse>(IAsyncStreamReader<TRequest> requestStream, IServerStreamWriter<TResponse> responseStream, ServerCallContext context, DuplexStreamingServerMethod<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Server-side handler for intercepting bidirectional streaming calls.

Parameters
Name Description
requestStream IAsyncStreamReader<TRequest>

The request stream of the incoming invocation.

responseStream IServerStreamWriter<TResponse>

The response stream of the incoming invocation.

context ServerCallContext

An instance of ServerCallContext representing the context of the invocation.

continuation DuplexStreamingServerMethod<TRequest, TResponse>

A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and the interceptor can choose to call it zero or more times at its discretion. The interceptor has the ability to wrap or substitute the request and response streams when calling the continuation.

Returns
Type Description
Task
Type Parameters
Name Description
TRequest

Request message type for this method.

TResponse

Response message type for this method.

ServerStreamingServerHandler<TRequest, TResponse>(TRequest, IServerStreamWriter<TResponse>, ServerCallContext, ServerStreamingServerMethod<TRequest, TResponse>)

public virtual Task ServerStreamingServerHandler<TRequest, TResponse>(TRequest request, IServerStreamWriter<TResponse> responseStream, ServerCallContext context, ServerStreamingServerMethod<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Server-side handler for intercepting server streaming call.

Parameters
Name Description
request TRequest

The request value of the incoming invocation.

responseStream IServerStreamWriter<TResponse>

The response stream of the incoming invocation.

context ServerCallContext

An instance of ServerCallContext representing the context of the invocation.

continuation ServerStreamingServerMethod<TRequest, TResponse>

A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and the interceptor can choose to call it zero or more times at its discretion. The interceptor has the ability to wrap or substitute the request value and the response stream when calling the continuation.

Returns
Type Description
Task
Type Parameters
Name Description
TRequest

Request message type for this method.

TResponse

Response message type for this method.

UnaryServerHandler<TRequest, TResponse>(TRequest, ServerCallContext, UnaryServerMethod<TRequest, TResponse>)

public virtual Task<TResponse> UnaryServerHandler<TRequest, TResponse>(TRequest request, ServerCallContext context, UnaryServerMethod<TRequest, TResponse> continuation)
    where TRequest : class where TResponse : class

Server-side handler for intercepting and incoming unary call.

Parameters
Name Description
request TRequest

The request value of the incoming invocation.

context ServerCallContext

An instance of ServerCallContext representing the context of the invocation.

continuation UnaryServerMethod<TRequest, TResponse>

A delegate that asynchronously proceeds with the invocation, calling the next interceptor in the chain, or the service request handler, in case of the last interceptor and return the response value of the RPC. The interceptor can choose to call it zero or more times at its discretion.

Returns
Type Description
Task<TResponse>

A future representing the response value of the RPC. The interceptor can simply return the return value from the continuation intact, or an arbitrary response value as it sees fit.

Type Parameters
Name Description
TRequest

Request message type for this method.

TResponse

Response message type for this method.