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.MultiClientBuilder
to 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 theGrpcClientBuilder
delegate.initializeHttp
(GrpcClientBuilder.HttpInitializer<U, R> initializer) Set a function which can configure the underlyingSingleAddressHttpClientBuilder
used for the transport layer.toString()
-
Constructor Details
-
DelegatingGrpcClientBuilder
-
-
Method Details
-
delegate
Returns theGrpcClientBuilder
delegate.- Returns:
- Delegate
GrpcClientBuilder
.
-
toString
-
initializeHttp
Description copied from interface:GrpcClientBuilder
Set a function which can configure the underlyingSingleAddressHttpClientBuilder
used for the transport layer.- Specified by:
initializeHttp
in interfaceGrpcClientBuilder<U,
R> - Parameters:
initializer
- Initializes the underlying HTTP transport builder.- Returns:
this
.
-
defaultTimeout
Description copied from interface:GrpcClientBuilder
Set 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:
defaultTimeout
in interfaceGrpcClientBuilder<U,
R> - Parameters:
defaultTimeout
-Duration
of 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:GrpcClientBuilder
Set 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:
defaultTimeout
in interfaceGrpcClientBuilder<U,
R> - Parameters:
defaultTimeout
-Duration
of default timeout which must be positive non-zero, ornull
if a default shouldn't be applied.appendTimeoutFilter
-true
to append the filter that enforces deadline propagation.false
to not append the filter and therefore not enforce deadlines. Iffalse
you 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:GrpcClientBuilder
Builds a gRPC client.- Specified by:
build
in interfaceGrpcClientBuilder<U,
R> - Type Parameters:
Client
- gRPC service that any client built from this factory represents.- Parameters:
clientFactory
-GrpcClientFactory
to use.- Returns:
- A gRPC client.
-
buildBlocking
public <BlockingClient extends BlockingGrpcClient<?>> BlockingClient buildBlocking(GrpcClientFactory<?, BlockingClient> clientFactory) Description copied from interface:GrpcClientBuilder
Builds a blocking gRPC client.- Specified by:
buildBlocking
in interfaceGrpcClientBuilder<U,
R> - Type Parameters:
BlockingClient
- Blocking gRPC service that any client built from this builder represents.- Parameters:
clientFactory
-GrpcClientFactory
to use.- Returns:
- A blocking gRPC client.
-
buildMulti
Description copied from interface:GrpcClientBuilder
Returns aGrpcClientBuilder.MultiClientBuilder
to 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:
buildMulti
in interfaceGrpcClientBuilder<U,
R> - Returns:
- A
builder
that allows reusing underlying transport between gRPC clients.
-