Package io.servicetalk.grpc.api
Class GrpcClientBuilder<U,R>
- java.lang.Object
-
- io.servicetalk.grpc.api.GrpcClientBuilder<U,R>
-
- Type Parameters:
U
- the type of address before resolution (unresolved address)R
- the type of address after resolution (resolved address)
public abstract class GrpcClientBuilder<U,R> extends java.lang.Object
A builder for building a gRPC client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
GrpcClientBuilder.MultiClientBuilder
An interface to create multiple gRPC clients sharing the same underlying transport instance.
-
Constructor Summary
Constructors Constructor Description GrpcClientBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract GrpcClientBuilder<U,R>
appendConnectionFactoryFilter(ConnectionFactoryFilter<R,FilterableStreamingHttpConnection> factory)
abstract GrpcClientBuilder<U,R>
appendConnectionFilter(StreamingHttpConnectionFilterFactory factory)
abstract GrpcClientBuilder<U,R>
appendConnectionFilter(java.util.function.Predicate<StreamingHttpRequest> predicate, StreamingHttpConnectionFilterFactory factory)
GrpcClientBuilder<U,R>
appendHttpClientFilter(StreamingHttpClientFilterFactory factory)
Append the filter to the chain of filters used to decorate the client created by this builder.GrpcClientBuilder<U,R>
appendHttpClientFilter(java.util.function.Predicate<StreamingHttpRequest> predicate, StreamingHttpClientFilterFactory factory)
Append the filter to the chain of filters used to decorate the client created by this builder, for every request that passes the providedPredicate
.abstract GrpcClientBuilder<U,R>
autoRetryStrategy(AutoRetryStrategyProvider autoRetryStrategyProvider)
abstract GrpcClientBuilder<U,R>
bufferAllocator(BufferAllocator allocator)
<Client extends GrpcClient<?>,Filter extends FilterableClient,FilterableClient extends FilterableGrpcClient,FilterFactory extends GrpcClientFilterFactory<Filter,FilterableClient>>
Clientbuild(GrpcClientFactory<Client,?,Filter,FilterableClient,FilterFactory> clientFactory)
Builds a gRPC client.<BlockingClient extends BlockingGrpcClient<?>,Filter extends FilterableClient,FilterableClient extends FilterableGrpcClient,FilterFactory extends GrpcClientFilterFactory<Filter,FilterableClient>>
BlockingClientbuildBlocking(GrpcClientFactory<?,BlockingClient,Filter,FilterableClient,FilterFactory> clientFactory)
Builds a blocking gRPC client.GrpcClientBuilder.MultiClientBuilder
buildMulti()
Returns aGrpcClientBuilder.MultiClientBuilder
to be used to create multiple clients sharing the same underlying transport instance.protected abstract void
doAppendHttpClientFilter(StreamingHttpClientFilterFactory factory)
Append the filter to the chain of filters used to decorate the client created by this builder.protected abstract void
doAppendHttpClientFilter(java.util.function.Predicate<StreamingHttpRequest> predicate, StreamingHttpClientFilterFactory factory)
Append the filter to the chain of filters used to decorate the client created by this builder, for every request that passes the providedPredicate
.abstract GrpcClientBuilder<U,R>
enableWireLogging(java.lang.String loggerName)
Deprecated.abstract GrpcClientBuilder<U,R>
enableWireLogging(java.lang.String loggerName, LogLevel logLevel, java.util.function.BooleanSupplier logUserData)
abstract GrpcClientBuilder<U,R>
executionStrategy(GrpcExecutionStrategy strategy)
abstract GrpcClientBuilder<U,R>
ioExecutor(IoExecutor ioExecutor)
abstract GrpcClientBuilder<U,R>
loadBalancerFactory(HttpLoadBalancerFactory<R> loadBalancerFactory)
protected abstract GrpcClientCallFactory
newGrpcClientCallFactory()
Create a newGrpcClientCallFactory
.abstract GrpcClientBuilder<U,R>
protocols(HttpProtocolConfig... protocols)
abstract GrpcClientSecurityConfigurator<U,R>
secure()
abstract GrpcClientBuilder<U,R>
serviceDiscoverer(ServiceDiscoverer<U,R,ServiceDiscovererEvent<R>> serviceDiscoverer)
abstract <T> GrpcClientBuilder<U,R>
socketOption(java.net.SocketOption<T> option, T value)
-
-
-
Method Detail
-
ioExecutor
public abstract GrpcClientBuilder<U,R> ioExecutor(IoExecutor ioExecutor)
-
bufferAllocator
public abstract GrpcClientBuilder<U,R> bufferAllocator(BufferAllocator allocator)
-
executionStrategy
public abstract GrpcClientBuilder<U,R> executionStrategy(GrpcExecutionStrategy strategy)
-
socketOption
public abstract <T> GrpcClientBuilder<U,R> socketOption(java.net.SocketOption<T> option, T value)
-
enableWireLogging
@Deprecated public abstract GrpcClientBuilder<U,R> enableWireLogging(java.lang.String loggerName)
Deprecated.
-
enableWireLogging
public abstract GrpcClientBuilder<U,R> enableWireLogging(java.lang.String loggerName, LogLevel logLevel, java.util.function.BooleanSupplier logUserData)
-
protocols
public abstract GrpcClientBuilder<U,R> protocols(HttpProtocolConfig... protocols)
-
appendConnectionFactoryFilter
public abstract GrpcClientBuilder<U,R> appendConnectionFactoryFilter(ConnectionFactoryFilter<R,FilterableStreamingHttpConnection> factory)
-
appendConnectionFilter
public abstract GrpcClientBuilder<U,R> appendConnectionFilter(StreamingHttpConnectionFilterFactory factory)
-
appendConnectionFilter
public abstract GrpcClientBuilder<U,R> appendConnectionFilter(java.util.function.Predicate<StreamingHttpRequest> predicate, StreamingHttpConnectionFilterFactory factory)
-
secure
public abstract GrpcClientSecurityConfigurator<U,R> secure()
-
autoRetryStrategy
public abstract GrpcClientBuilder<U,R> autoRetryStrategy(AutoRetryStrategyProvider autoRetryStrategyProvider)
-
serviceDiscoverer
public abstract GrpcClientBuilder<U,R> serviceDiscoverer(ServiceDiscoverer<U,R,ServiceDiscovererEvent<R>> serviceDiscoverer)
-
loadBalancerFactory
public abstract GrpcClientBuilder<U,R> loadBalancerFactory(HttpLoadBalancerFactory<R> loadBalancerFactory)
-
appendHttpClientFilter
public final GrpcClientBuilder<U,R> appendHttpClientFilter(StreamingHttpClientFilterFactory factory)
Append the filter to the chain of filters used to decorate the client created by this builder.The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder.append(filter1).append(filter2).append(filter3)
making a request to a client wrapped by this filter chain the order of invocation of these filters will be:filter1 => filter2 => filter3 => client
- Parameters:
factory
-StreamingHttpClientFilterFactory
to decorate a client for the purpose of filtering.- Returns:
this
-
appendHttpClientFilter
public final GrpcClientBuilder<U,R> appendHttpClientFilter(java.util.function.Predicate<StreamingHttpRequest> predicate, StreamingHttpClientFilterFactory factory)
Append the filter to the chain of filters used to decorate the client created by this builder, for every request that passes the providedPredicate
.The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder.append(filter1).append(filter2).append(filter3)
making a request to a client wrapped by this filter chain the order of invocation of these filters will be:filter1 => filter2 => filter3 => client
- Parameters:
predicate
- thePredicate
to test if the filter must be applied.factory
-StreamingHttpClientFilterFactory
to decorate a client for the purpose of filtering.- Returns:
this
-
build
public final <Client extends GrpcClient<?>,Filter extends FilterableClient,FilterableClient extends FilterableGrpcClient,FilterFactory extends GrpcClientFilterFactory<Filter,FilterableClient>> Client build(GrpcClientFactory<Client,?,Filter,FilterableClient,FilterFactory> clientFactory)
Builds a gRPC client.- Type Parameters:
Client
- gRPC service that any client built from this factory represents.Filter
- Type for client filterFilterableClient
- Type of filterable client.FilterFactory
- Type ofGrpcClientFilterFactory
- Parameters:
clientFactory
-GrpcClientFactory
to use.- Returns:
- A gRPC client.
-
buildBlocking
public final <BlockingClient extends BlockingGrpcClient<?>,Filter extends FilterableClient,FilterableClient extends FilterableGrpcClient,FilterFactory extends GrpcClientFilterFactory<Filter,FilterableClient>> BlockingClient buildBlocking(GrpcClientFactory<?,BlockingClient,Filter,FilterableClient,FilterFactory> clientFactory)
Builds a blocking gRPC client.- Type Parameters:
BlockingClient
- Blocking gRPC service that any client built from this builder represents.Filter
- Type for client filterFilterableClient
- Type of filterable client.FilterFactory
- Type ofGrpcClientFilterFactory
- Parameters:
clientFactory
-GrpcClientFactory
to use.- Returns:
- A blocking gRPC client.
-
buildMulti
public final GrpcClientBuilder.MultiClientBuilder buildMulti()
Returns aGrpcClientBuilder.MultiClientBuilder
to be used to create multiple clients sharing the same underlying transport instance.- Returns:
- A blocking gRPC client.
-
newGrpcClientCallFactory
protected abstract GrpcClientCallFactory newGrpcClientCallFactory()
Create a newGrpcClientCallFactory
.- Returns:
- A new
GrpcClientCallFactory
.
-
doAppendHttpClientFilter
protected abstract void doAppendHttpClientFilter(StreamingHttpClientFilterFactory factory)
Append the filter to the chain of filters used to decorate the client created by this builder.The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder.append(filter1).append(filter2).append(filter3)
making a request to a client wrapped by this filter chain the order of invocation of these filters will be:filter1 => filter2 => filter3 => client
- Parameters:
factory
-StreamingHttpClientFilterFactory
to decorate a client for the purpose of filtering.
-
doAppendHttpClientFilter
protected abstract void doAppendHttpClientFilter(java.util.function.Predicate<StreamingHttpRequest> predicate, StreamingHttpClientFilterFactory factory)
Append the filter to the chain of filters used to decorate the client created by this builder, for every request that passes the providedPredicate
.The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder.append(filter1).append(filter2).append(filter3)
making a request to a client wrapped by this filter chain the order of invocation of these filters will be:filter1 => filter2 => filter3 => client
- Parameters:
predicate
- thePredicate
to test if the filter must be applied.factory
-StreamingHttpClientFilterFactory
to decorate a client for the purpose of filtering.
-
-