Show / Hide Table of Contents

Class CallSettings

Settings to determine how an RPC operates. This type is immutable.

Inheritance
System.Object
CallSettings
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Api.Gax.Grpc
Assembly: Google.Api.Gax.Grpc.dll
Syntax
public sealed class CallSettings

Constructors

CallSettings(Nullable<CancellationToken>, CallCredentials, CallTiming, Action<Metadata>, WriteOptions, ContextPropagationToken)

Constructs an instance with the specified settings.

Declaration
public CallSettings(CancellationToken? cancellationToken, CallCredentials credentials, CallTiming timing, Action<Metadata> headerMutation, WriteOptions writeOptions, ContextPropagationToken propagationToken)
Parameters
Type Name Description
System.Nullable<System.Threading.CancellationToken> cancellationToken

Cancellation token that can be used for cancelling the call.

CallCredentials credentials

Credentials to use for the call.

CallTiming timing

CallTiming to use, or null for default retry/expiration behavior.

System.Action<Metadata> headerMutation

Action to modify the headers to send at the beginning of the call.

WriteOptions writeOptions

WriteOptions that will be used for the call.

ContextPropagationToken propagationToken

ContextPropagationToken for propagating settings from a parent call.

CallSettings(Nullable<CancellationToken>, CallCredentials, CallTiming, Action<Metadata>, WriteOptions, ContextPropagationToken, Action<Metadata>, Action<Metadata>)

Constructs an instance with the specified settings.

Declaration
public CallSettings(CancellationToken? cancellationToken, CallCredentials credentials, CallTiming timing, Action<Metadata> headerMutation, WriteOptions writeOptions, ContextPropagationToken propagationToken, Action<Metadata> responseMetadataHandler, Action<Metadata> trailingMetadataHandler)
Parameters
Type Name Description
System.Nullable<System.Threading.CancellationToken> cancellationToken

Cancellation token that can be used for cancelling the call.

CallCredentials credentials

Credentials to use for the call.

CallTiming timing

CallTiming to use, or null for default retry/expiration behavior.

System.Action<Metadata> headerMutation

Action to modify the headers to send at the beginning of the call.

WriteOptions writeOptions

WriteOptions that will be used for the call.

ContextPropagationToken propagationToken

ContextPropagationToken for propagating settings from a parent call.

System.Action<Metadata> responseMetadataHandler

Action to invoke when response metadata is received.

System.Action<Metadata> trailingMetadataHandler

Action to invoke when trailing metadata is received.

Properties

CancellationToken

Cancellation token that can be used for cancelling the call.

Declaration
public CancellationToken? CancellationToken { get; }
Property Value
Type Description
System.Nullable<System.Threading.CancellationToken>

Credentials

Credentials to use for the call.

Declaration
public CallCredentials Credentials { get; }
Property Value
Type Description
CallCredentials

HeaderMutation

Delegate to mutate the metadata which will be sent at the start of the call, typically to add custom headers.

Declaration
public Action<Metadata> HeaderMutation { get; }
Property Value
Type Description
System.Action<Metadata>

PropagationToken

ContextPropagationToken for propagating settings from a parent call.

Declaration
public ContextPropagationToken PropagationToken { get; }
Property Value
Type Description
ContextPropagationToken

ResponseMetadataHandler

Delegate to receive the metadata associated with a response.

Declaration
public Action<Metadata> ResponseMetadataHandler { get; }
Property Value
Type Description
System.Action<Metadata>

Timing

CallTiming to use, or null for default retry/expiration behavior.

Declaration
public CallTiming Timing { get; }
Property Value
Type Description
CallTiming
Remarks

Allows selecting between retry and simple expiration.

TrailingMetadataHandler

Delegate to receive the metadata sent after the response.

Declaration
public Action<Metadata> TrailingMetadataHandler { get; }
Property Value
Type Description
System.Action<Metadata>

WriteOptions

WriteOptions that will be used for the call.

Declaration
public WriteOptions WriteOptions { get; }
Property Value
Type Description
WriteOptions

Methods

FromCallCredentials(CallCredentials)

Creates a CallSettings for the specified call credentials, or returns null if credentials is null.

Declaration
public static CallSettings FromCallCredentials(CallCredentials credentials)
Parameters
Type Name Description
CallCredentials credentials

The call credentials for the new settings.

Returns
Type Description
CallSettings

A new instance, or null if credentials is null.

FromCallTiming(CallTiming)

Creates a CallSettings for the specified call timing, or returns null if timing is null.

Declaration
public static CallSettings FromCallTiming(CallTiming timing)
Parameters
Type Name Description
CallTiming timing

The call timing for the new settings.

Returns
Type Description
CallSettings

A new instance or null if timing is null..

FromCancellationToken(CancellationToken)

Creates a CallSettings for the specified cancellation token.

Declaration
public static CallSettings FromCancellationToken(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The cancellation token for the new settings.

Returns
Type Description
CallSettings

A new instance.

FromFieldMask(String)

Creates a CallSettings that will include a field mask in the request, to limit which fields are returned in the response.

Declaration
public static CallSettings FromFieldMask(string fieldMask)
Parameters
Type Name Description
System.String fieldMask

The field mask for the request. Must not be null.

Returns
Type Description
CallSettings

A new instance.

Remarks

The precise effect on the request is not guaranteed: it may be through a header or a side-channel, for example. Likewise the effect of combining multiple settings containing field masks is not specified.

FromHeader(String, String)

Creates a CallSettings for the specified header name and value.

Declaration
public static CallSettings FromHeader(string name, string value)
Parameters
Type Name Description
System.String name

The name of the header to add. Must not be null.

System.String value

The value of the header to add. Must not be null.

Returns
Type Description
CallSettings

A new instance.

FromHeaderMutation(Action<Metadata>)

Creates a CallSettings for the specified header mutation, or returns null if headerMutation is null.

Declaration
public static CallSettings FromHeaderMutation(Action<Metadata> headerMutation)
Parameters
Type Name Description
System.Action<Metadata> headerMutation

Action to modify the headers to send at the beginning of the call.

Returns
Type Description
CallSettings

A new instance, or null if headerMutation is null..

FromResponseMetadataHandler(Action<Metadata>)

Creates a CallSettings for the specified response metadata handler, or returns null if responseMetadataHandler is null.

Declaration
public static CallSettings FromResponseMetadataHandler(Action<Metadata> responseMetadataHandler)
Parameters
Type Name Description
System.Action<Metadata> responseMetadataHandler

Action to receive response metadata when the call completes.

Returns
Type Description
CallSettings

A new instance, or null if responseMetadataHandler is null..

FromTrailingMetadataHandler(Action<Metadata>)

Creates a CallSettings for the specified trailing metadata handler, or returns null if trailingMetadataHandler is null.

Declaration
public static CallSettings FromTrailingMetadataHandler(Action<Metadata> trailingMetadataHandler)
Parameters
Type Name Description
System.Action<Metadata> trailingMetadataHandler

Action to receive trailing metadata when the call completes.

Returns
Type Description
CallSettings

A new instance, or null if trailingMetadataHandler is null..

Extension Methods

CallSettingsExtensions.MergedWith(CallSettings, CallSettings)
CallSettingsExtensions.WithCancellationToken(CallSettings, CancellationToken)
CallSettingsExtensions.WithCallCredentials(CallSettings, CallCredentials)
CallSettingsExtensions.WithCallTiming(CallSettings, CallTiming)
CallSettingsExtensions.WithHeader(CallSettings, String, String)
CallSettingsExtensions.WithResponseMetadataHandler(CallSettings, Action<Metadata>)
CallSettingsExtensions.WithTrailingMetadataHandler(CallSettings, Action<Metadata>)
CallSettingsExtensions.WithEarlierDeadline(CallSettings, Nullable<DateTime>, IClock)
CallSettingsExtensions.WithExpiration(CallSettings, Expiration)
Back to top