Show / Hide Table of Contents

    Class Interceptor

    Serves as the base class for gRPC interceptors.

    Inheritance
    System.Object
    Interceptor
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Grpc.Core.Interceptors
    Assembly: Grpc.Core.Api.dll
    Syntax
    public abstract class Interceptor

    Methods

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

    Intercepts an asynchronous invocation of a client streaming call.

    Declaration
    public virtual AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(ClientInterceptorContext<TRequest, TResponse> context, Interceptor.AsyncClientStreamingCallContinuation<TRequest, TResponse> continuation)
        where TRequest : class where TResponse : class
    Parameters
    Type Name Description
    ClientInterceptorContext<TRequest, TResponse> context

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

    Interceptor.AsyncClientStreamingCallContinuation<TRequest, TResponse> continuation

    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>)

    Intercepts an asynchronous invocation of a duplex streaming call.

    Declaration
    public virtual AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(ClientInterceptorContext<TRequest, TResponse> context, Interceptor.AsyncDuplexStreamingCallContinuation<TRequest, TResponse> continuation)
        where TRequest : class where TResponse : class
    Parameters
    Type Name Description
    ClientInterceptorContext<TRequest, TResponse> context

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

    Interceptor.AsyncDuplexStreamingCallContinuation<TRequest, TResponse> continuation

    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>)

    Intercepts an asynchronous invocation of a streaming remote call.

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

    The request message of the invocation.

    ClientInterceptorContext<TRequest, TResponse> context

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

    Interceptor.AsyncServerStreamingCallContinuation<TRequest, TResponse> continuation

    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>)

    Intercepts an asynchronous invocation of a simple remote call.

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

    The request message of the invocation.

    ClientInterceptorContext<TRequest, TResponse> context

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

    Interceptor.AsyncUnaryCallContinuation<TRequest, TResponse> continuation

    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>)

    Intercepts a blocking invocation of a simple remote call.

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

    The request message of the invocation.

    ClientInterceptorContext<TRequest, TResponse> context

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

    Interceptor.BlockingUnaryCallContinuation<TRequest, TResponse> continuation

    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>)

    Server-side handler for intercepting client streaming call.

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

    The request stream of the incoming invocation.

    ServerCallContext context

    An instance of ServerCallContext representing the context of the invocation.

    ClientStreamingServerMethod<TRequest, TResponse> continuation

    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
    System.Threading.Tasks.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>)

    Server-side handler for intercepting bidirectional streaming calls.

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

    The request stream of the incoming invocation.

    IServerStreamWriter<TResponse> responseStream

    The response stream of the incoming invocation.

    ServerCallContext context

    An instance of ServerCallContext representing the context of the invocation.

    DuplexStreamingServerMethod<TRequest, TResponse> continuation

    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
    System.Threading.Tasks.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>)

    Server-side handler for intercepting server streaming call.

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

    The request value of the incoming invocation.

    IServerStreamWriter<TResponse> responseStream

    The response stream of the incoming invocation.

    ServerCallContext context

    An instance of ServerCallContext representing the context of the invocation.

    ServerStreamingServerMethod<TRequest, TResponse> continuation

    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
    System.Threading.Tasks.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>)

    Server-side handler for intercepting and incoming unary call.

    Declaration
    public virtual Task<TResponse> UnaryServerHandler<TRequest, TResponse>(TRequest request, ServerCallContext context, UnaryServerMethod<TRequest, TResponse> continuation)
        where TRequest : class where TResponse : class
    Parameters
    Type Name Description
    TRequest request

    The request value of the incoming invocation.

    ServerCallContext context

    An instance of ServerCallContext representing the context of the invocation.

    UnaryServerMethod<TRequest, TResponse> continuation

    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
    System.Threading.Tasks.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.

    Back to top Generated by DocFX