public sealed class GcpCallInvokerPool
A pool of GCP call invokers for the same service, but with potentially different endpoints and/or channel options. Each endpoint/options pair has a single GcpCallInvoker. All call invokers created by this pool use default application credentials. This class is thread-safe.
Namespace
GoogleGoogle.ApiGaxGrpcGcpAssembly
Google.Api.Gax.Grpc.dll
Constructors
GcpCallInvokerPool(ServiceMetadata)
public GcpCallInvokerPool(ServiceMetadata serviceMetadata)
Creates a call invoker pool which will use the given service metadata to determine scopes and self-signed JWT support.
Parameter | |
---|---|
Name | Description |
serviceMetadata | ServiceMetadata The metadata for the service that this pool will be used with. Must not be null. |
Methods
GetCallInvoker(string, GrpcChannelOptions, ApiConfig, GrpcAdapter)
public GcpCallInvoker GetCallInvoker(string endpoint, GrpcChannelOptions options, ApiConfig apiConfig, GrpcAdapter adapter)
Returns a call invoker from this pool, creating a new one if there is no call invoker
already associated with endpoint
and options
.
Parameters | |
---|---|
Name | Description |
endpoint | string The endpoint to connect to. Must not be null. |
options | GrpcChannelOptions The options to use for each channel created by the call invoker. May be null. |
apiConfig | ApiConfig The API configuration used to determine channel keys. Must not be null. |
adapter | GrpcAdapter The gRPC adapter to use to create call invokers. Must not be null. |
Returns | |
---|---|
Type | Description |
GcpCallInvoker | A call invoker for the specified endpoint. |
GetCallInvokerAsync(string, GrpcChannelOptions, ApiConfig, GrpcAdapter)
public Task<GcpCallInvoker> GetCallInvokerAsync(string endpoint, GrpcChannelOptions options, ApiConfig apiConfig, GrpcAdapter adapter)
Asynchronously returns a call invoker from this pool, creating a new one if there is no call invoker
already associated with endpoint
and options
.
Parameters | |
---|---|
Name | Description |
endpoint | string The endpoint to connect to. Must not be null. |
options | GrpcChannelOptions The options to use for each channel created by the call invoker. May be null. |
apiConfig | ApiConfig The API configuration used to determine channel keys. Must not be null. |
adapter | GrpcAdapter The gRPC adapter to use to create call invokers. Must not be null. |
Returns | |
---|---|
Type | Description |
TaskGcpCallInvoker | A task representing the asynchronous operation. The value of the completed task will be a call invoker for the specified endpoint. |
ShutdownChannelsAsync()
public Task ShutdownChannelsAsync()
Shuts down all the open channels of all currently-allocated call invokers asynchronously. This does not prevent the call invoker pool from being used later on, but the currently-allocated call invokers will not be reused.
Returns | |
---|---|
Type | Description |
Task | A task which will complete when all the (current) channels have been shut down. |