Package io.servicetalk.grpc.api
Class DelegatingGrpcClientBuilder<U,R>
java.lang.Object
io.servicetalk.grpc.api.DelegatingGrpcClientBuilder<U,R>
- Type Parameters:
U- the type of address before resolution (unresolved address)R- the type of address after resolution (resolved address)
- All Implemented Interfaces:
GrpcClientBuilder<U,R>
A
GrpcClientBuilder that delegates all methods to another GrpcClientBuilder.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.servicetalk.grpc.api.GrpcClientBuilder
GrpcClientBuilder.HttpInitializer<U,R>, GrpcClientBuilder.MultiClientBuilder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<Client extends GrpcClient<?>>
Clientbuild(GrpcClientFactory<Client, ?> clientFactory) Builds a gRPC client.<BlockingClient extends BlockingGrpcClient<?>>
BlockingClientbuildBlocking(GrpcClientFactory<?, BlockingClient> clientFactory) Builds a blocking gRPC client.Returns aGrpcClientBuilder.MultiClientBuilderto be used to create multiple clients that share the underlying transport.defaultTimeout(Duration defaultTimeout) Set default timeout during which gRPC calls are expected to complete.defaultTimeout(Duration defaultTimeout, boolean appendTimeoutFilter) Set default timeout during which gRPC calls are expected to complete.protected final GrpcClientBuilder<U,R> delegate()Returns theGrpcClientBuilderdelegate.initializeHttp(GrpcClientBuilder.HttpInitializer<U, R> initializer) Set a function which can configure the underlyingSingleAddressHttpClientBuilderused for the transport layer.toString()
-
Constructor Details
-
DelegatingGrpcClientBuilder
-
-
Method Details
-
delegate
Returns theGrpcClientBuilderdelegate.- Returns:
- Delegate
GrpcClientBuilder.
-
toString
-
initializeHttp
Description copied from interface:GrpcClientBuilderSet a function which can configure the underlyingSingleAddressHttpClientBuilderused for the transport layer.- Specified by:
initializeHttpin interfaceGrpcClientBuilder<U,R> - Parameters:
initializer- Initializes the underlying HTTP transport builder.- Returns:
this.
-
defaultTimeout
Description copied from interface:GrpcClientBuilderSet default timeout during which gRPC calls are expected to complete. This default will be used only if the request metadata includes no timeout; any value specified in client request will supersede this default.- Specified by:
defaultTimeoutin interfaceGrpcClientBuilder<U,R> - Parameters:
defaultTimeout-Durationof default timeout which must be positive non-zero.- Returns:
this.- See Also:
-
defaultTimeout
public GrpcClientBuilder<U,R> defaultTimeout(@Nullable Duration defaultTimeout, boolean appendTimeoutFilter) Description copied from interface:GrpcClientBuilderSet default timeout during which gRPC calls are expected to complete. This default will be used only if the request metadata includes no timeout; any value specified in client request will supersede this default.- Specified by:
defaultTimeoutin interfaceGrpcClientBuilder<U,R> - Parameters:
defaultTimeout-Durationof default timeout which must be positive non-zero, ornullif a default shouldn't be applied.appendTimeoutFilter-trueto append the filter that enforces deadline propagation.falseto not append the filter and therefore not enforce deadlines. Iffalseyou can manually insertGrpcFilters.newGrpcDeadlineClientFilterFactory()in your preferred order useGrpcClientBuilder.initializeHttp(io.servicetalk.grpc.api.GrpcClientBuilder.HttpInitializer<U, R>)andSingleAddressHttpClientBuilder.appendClientFilter(StreamingHttpClientFilterFactory).- Returns:
this.- See Also:
-
build
Description copied from interface:GrpcClientBuilderBuilds a gRPC client.- Specified by:
buildin interfaceGrpcClientBuilder<U,R> - Type Parameters:
Client- gRPC service that any client built from this factory represents.- Parameters:
clientFactory-GrpcClientFactoryto use.- Returns:
- A gRPC client.
-
buildBlocking
public <BlockingClient extends BlockingGrpcClient<?>> BlockingClient buildBlocking(GrpcClientFactory<?, BlockingClient> clientFactory) Description copied from interface:GrpcClientBuilderBuilds a blocking gRPC client.- Specified by:
buildBlockingin interfaceGrpcClientBuilder<U,R> - Type Parameters:
BlockingClient- Blocking gRPC service that any client built from this builder represents.- Parameters:
clientFactory-GrpcClientFactoryto use.- Returns:
- A blocking gRPC client.
-
buildMulti
Description copied from interface:GrpcClientBuilderReturns aGrpcClientBuilder.MultiClientBuilderto be used to create multiple clients that share the underlying transport. It is meant for a single backend that hosts different service APIs.- Specified by:
buildMultiin interfaceGrpcClientBuilder<U,R> - Returns:
- A
builderthat allows reusing underlying transport between gRPC clients.
-