Package com.google.api.gax.grpc
Class InstantiatingGrpcChannelProvider
java.lang.Object
com.google.api.gax.grpc.InstantiatingGrpcChannelProvider
- All Implemented Interfaces:
TransportChannelProvider
public final class InstantiatingGrpcChannelProvider
extends Object
implements TransportChannelProvider
InstantiatingGrpcChannelProvider is a TransportChannelProvider which constructs a gRPC
ManagedChannel with a number of configured inputs every time getChannel(...) is called. These
inputs include a port, a service address, and credentials.
The credentials can either be supplied directly (by providing a FixedCredentialsProvider to Builder.setCredentialsProvider()) or acquired implicitly from Application Default Credentials (by providing a GoogleCredentialsProvider to Builder.setCredentialsProvider()).
The client lib header and generator header values are used to form a value that goes into the http header of requests to the service.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic enum -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.booleanMarked as Internal Api and intended for internal use.The configured channel pool settings used for gRPC's ChannelProviderThe endpoint to be used for the channel.org.threeten.bp.DurationThis method is obsolete.The time without read activity before sending a keepalive ping.org.threeten.bp.DurationThis method is obsolete.The time without read activity after sending a keepalive ping.Whether keepalive will be performed when there are no outstanding RPCs.The maximum metadata size allowed to be received on the channel.booleanThis method tells if Direct Path xDS was enabled.booleanbooleanbooleanDeprecated.If executor is not set, this channel provider will create channels with default grpc executor.booleanbooleanbooleanwithCredentials(com.google.auth.Credentials credentials) withEndpoint(String endpoint) Specify the endpoint the channel should connect to.withExecutor(Executor executor) withExecutor(ScheduledExecutorService executor) Deprecated.withHeaders(Map<String, String> headers) withMtlsEndpoint(String mtlsEndpoint) Specify the mTLS endpoint the channel should connect to when using S2A.withPoolSize(int size) Deprecated.Please modify pool settings viatoBuilder()withUseS2A(boolean useS2A) Specify whether or not to use S2A.
-
Method Details
-
needsExecutor
Deprecated.If executor is not set, this channel provider will create channels with default grpc executor.- Specified by:
needsExecutorin interfaceTransportChannelProvider
-
withExecutor
Deprecated.- Specified by:
withExecutorin interfaceTransportChannelProvider
-
withExecutor
- Specified by:
withExecutorin interfaceTransportChannelProvider
-
needsHeaders
public boolean needsHeaders()- Specified by:
needsHeadersin interfaceTransportChannelProvider
-
withHeaders
- Specified by:
withHeadersin interfaceTransportChannelProvider
-
getTransportName
- Specified by:
getTransportNamein interfaceTransportChannelProvider
-
needsEndpoint
public boolean needsEndpoint()- Specified by:
needsEndpointin interfaceTransportChannelProvider
-
needsMtlsEndpoint
@InternalApi("This public method is used by Gax to help configure the MTLS endpoint for S2A") public boolean needsMtlsEndpoint()- Specified by:
needsMtlsEndpointin interfaceTransportChannelProvider
-
withEndpoint
Specify the endpoint the channel should connect to.The value of
endpointmust be of the formhost:port.- Specified by:
withEndpointin interfaceTransportChannelProvider- Parameters:
endpoint- The endpoint to connect to- Returns:
- A new
InstantiatingGrpcChannelProviderwith the specified endpoint configured
-
withMtlsEndpoint
@InternalApi("This public method is used by Gax to help configure the MTLS endpoint for S2A") public TransportChannelProvider withMtlsEndpoint(String mtlsEndpoint) Specify the mTLS endpoint the channel should connect to when using S2A.The value of
mtlsEndpointmust be of the formhost:port.- Specified by:
withMtlsEndpointin interfaceTransportChannelProvider- Parameters:
mtlsEndpoint- The mtTLS endpoint to connect to- Returns:
- A new
InstantiatingGrpcChannelProviderwith the specified mTLS endpoint configured
-
withUseS2A
Specify whether or not to use S2A.- Specified by:
withUseS2Ain interfaceTransportChannelProvider- Parameters:
useS2A-- Returns:
- A new
InstantiatingGrpcChannelProviderwith useS2A set.
-
acceptsPoolSize
Deprecated.Please modify pool settings viatoBuilder()- Specified by:
acceptsPoolSizein interfaceTransportChannelProvider
-
withPoolSize
Deprecated.Please modify pool settings viatoBuilder()- Specified by:
withPoolSizein interfaceTransportChannelProvider
-
needsCredentials
public boolean needsCredentials()- Specified by:
needsCredentialsin interfaceTransportChannelProvider
-
withCredentials
- Specified by:
withCredentialsin interfaceTransportChannelProvider
-
getTransportChannel
- Specified by:
getTransportChannelin interfaceTransportChannelProvider- Throws:
IOException
-
isDirectPathXdsEnabled
This method tells if Direct Path xDS was enabled. There are two ways of enabling it: via environment variable (by setting GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS=true) or when building this channel provider (via theInstantiatingGrpcChannelProvider.Builder.setAttemptDirectPathXds()method).- Returns:
- true if Direct Path xDS was either enabled via env var or via builder option
-
canUseDirectPath
Marked as Internal Api and intended for internal use. DirectPath must be enabled via the settings and a few other configurations/settings must also be valid for the request to go through DirectPath.Checks: 1. Credentials are compatible 2.Running on Compute Engine 3. Universe Domain is configured to for the Google Default Universe
- Returns:
- if DirectPath is enabled for the client AND if the configurations are valid
-
getEndpoint
The endpoint to be used for the channel.- Specified by:
getEndpointin interfaceTransportChannelProvider
-
getKeepAliveTime
@ObsoleteApi("Use getKeepAliveTimeDuration() instead") public org.threeten.bp.Duration getKeepAliveTime()This method is obsolete. UsegetKeepAliveTimeDuration()instead. -
getKeepAliveTimeDuration
The time without read activity before sending a keepalive ping. -
getKeepAliveTimeout
@ObsoleteApi("Use getKeepAliveTimeoutDuration() instead") public org.threeten.bp.Duration getKeepAliveTimeout()This method is obsolete. UsegetKeepAliveTimeoutDuration()instead -
getKeepAliveTimeoutDuration
The time without read activity after sending a keepalive ping. -
getKeepAliveWithoutCalls
Whether keepalive will be performed when there are no outstanding RPCs. -
getMaxInboundMetadataSize
@BetaApi("The surface for maximum metadata size is not stable yet and may change in the future.") public Integer getMaxInboundMetadataSize()The maximum metadata size allowed to be received on the channel. -
getChannelPoolSettings
@BetaApi("Channel pool sizing api is not yet stable") public ChannelPoolSettings getChannelPoolSettings()The configured channel pool settings used for gRPC's ChannelProvider -
shouldAutoClose
public boolean shouldAutoClose()- Specified by:
shouldAutoClosein interfaceTransportChannelProvider
-
toBuilder
-
newBuilder
-
toBuilder()