<PackageReference Include="Grpc.Net.Client" Version="2.71.0-pre1" />

Grpc.Net.Client.Balancer.PickResult

public sealed class PickResult
A balancing decision made by a SubchannelPicker for a gRPC call.

Note: Experimental API that can change or be removed without any prior notice.

public Status Status { get; }

The Status provided by ForFailure or ForDrop.

public Subchannel Subchannel { get; }

The Subchannel provided by ForSubchannel.

The optional SubchannelCallTracker provided by ForSubchannel.

public PickResultType Type { get; }

The pick result type.

public static PickResult ForDrop(Status status)

Creates a PickResult to fail a gRPC call immediately. A result with a type of Drop causes calls to ignore IsWaitForReady and retry.

public static PickResult ForFailure(Status status)

Creates a PickResult to report a connectivity error to calls. If the call has a IsWaitForReady value of true then the call will wait.

public static PickResult ForQueue()

Creates a PickResult to queue gRPC calls.

public static PickResult ForSubchannel(Subchannel subchannel, ISubchannelCallTracker subchannelCallTracker = null)

Create a PickResult that provides a Subchannel to gRPC calls.

A result created with a Subchannel won't necessarily be used by a gRPC call. The subchannel's state may change at the same time the picker is making a decision. That means the decision may be made with outdated information. For example, a picker may return a subchannel with a state that is Ready, but becomes Idle when the subchannel is about to be used. In that situation the gRPC call waits for the load balancer to react to the new state and create a new picker.