public final class GrpcClients
extends Object
| Modifier and Type | Method and Description |
|---|---|
static GrpcClientBuilder<HostAndPort,InetSocketAddress> |
forAddress(HostAndPort address)
Creates a
GrpcClientBuilder for an address with default LoadBalancer and DNS
ServiceDiscoverer using background discovery strategy. |
static GrpcClientBuilder<HostAndPort,InetSocketAddress> |
forAddress(HostAndPort address,
HttpClients.DiscoveryStrategy discoveryStrategy)
Creates a
GrpcClientBuilder for an address with default LoadBalancer and DNS
ServiceDiscoverer using the specified HttpClients.DiscoveryStrategy. |
static <U,R> GrpcClientBuilder<U,R> |
forAddress(ServiceDiscoverer<U,R,? extends ServiceDiscovererEvent<R>> serviceDiscoverer,
U address)
Creates a
GrpcClientBuilder for a custom address type with default LoadBalancer and user
provided ServiceDiscoverer using background discovery strategy. |
static <U,R> GrpcClientBuilder<U,R> |
forAddress(ServiceDiscoverer<U,R,? extends ServiceDiscovererEvent<R>> serviceDiscoverer,
U address,
HttpClients.DiscoveryStrategy discoveryStrategy)
Creates a
GrpcClientBuilder for a custom address type with default LoadBalancer and user
provided ServiceDiscoverer using the specified HttpClients.DiscoveryStrategy. |
static GrpcClientBuilder<HostAndPort,InetSocketAddress> |
forAddress(String host,
int port)
Creates a
GrpcClientBuilder for an address with default LoadBalancer and DNS
ServiceDiscoverer using background discovery strategy. |
static GrpcClientBuilder<HostAndPort,InetSocketAddress> |
forAddress(String host,
int port,
HttpClients.DiscoveryStrategy discoveryStrategy)
Creates a
GrpcClientBuilder for an address with default LoadBalancer and DNS
ServiceDiscoverer using the specified HttpClients.DiscoveryStrategy. |
static GrpcClientBuilder<HostAndPort,InetSocketAddress> |
forResolvedAddress(HostAndPort address)
Creates a
GrpcClientBuilder for an address with default LoadBalancer. |
static GrpcClientBuilder<InetSocketAddress,InetSocketAddress> |
forResolvedAddress(InetSocketAddress address)
Creates a
GrpcClientBuilder for an address with default LoadBalancer. |
static GrpcClientBuilder<HostAndPort,InetSocketAddress> |
forResolvedAddress(String host,
int port)
Creates a
GrpcClientBuilder for a resolved address with default LoadBalancer. |
static <T extends SocketAddress> |
forResolvedAddress(T address)
Creates a
GrpcClientBuilder for an address with default LoadBalancer. |
static GrpcClientBuilder<String,InetSocketAddress> |
forServiceAddress(String serviceName)
Creates a
GrpcClientBuilder for the passed serviceName with default LoadBalancer and a
DNS ServiceDiscoverer using SRV record lookups. |
public static GrpcClientBuilder<HostAndPort,InetSocketAddress> forAddress(String host,
int port)
GrpcClientBuilder for an address with default LoadBalancer and DNS
ServiceDiscoverer using background discovery strategy.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
host - host to connect to, resolved by default using a DNS ServiceDiscoverer.port - port to connect toGrpcProviders.GrpcClientBuilderProviderpublic static GrpcClientBuilder<HostAndPort,InetSocketAddress> forAddress(HostAndPort address)
GrpcClientBuilder for an address with default LoadBalancer and DNS
ServiceDiscoverer using background discovery strategy.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
address - the UnresolvedAddress to connect to, resolved by default using a DNS
ServiceDiscoverer.GrpcProviders.GrpcClientBuilderProviderpublic static GrpcClientBuilder<HostAndPort,InetSocketAddress> forAddress(String host,
int port,
HttpClients.DiscoveryStrategy discoveryStrategy)
GrpcClientBuilder for an address with default LoadBalancer and DNS
ServiceDiscoverer using the specified HttpClients.DiscoveryStrategy.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
host - host to connect to, resolved by default using a DNS ServiceDiscoverer.port - port to connect todiscoveryStrategy - HttpClients.DiscoveryStrategy to useGrpcProviders.GrpcClientBuilderProviderpublic static GrpcClientBuilder<HostAndPort,InetSocketAddress> forAddress(HostAndPort address,
HttpClients.DiscoveryStrategy discoveryStrategy)
GrpcClientBuilder for an address with default LoadBalancer and DNS
ServiceDiscoverer using the specified HttpClients.DiscoveryStrategy.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
address - the UnresolvedAddress to connect to, resolved by default using a DNS
ServiceDiscoverer.discoveryStrategy - HttpClients.DiscoveryStrategy to useGrpcProviders.GrpcClientBuilderProviderpublic static GrpcClientBuilder<String,InetSocketAddress> forServiceAddress(String serviceName)
GrpcClientBuilder for the passed serviceName with default LoadBalancer and a
DNS ServiceDiscoverer using SRV record lookups.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
serviceName - the service name to query via SRV DNS.GrpcProviders.GrpcClientBuilderProviderpublic static GrpcClientBuilder<HostAndPort,InetSocketAddress> forResolvedAddress(String host,
int port)
GrpcClientBuilder for a resolved address with default LoadBalancer.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
host - resolved host address to connect to.port - port to connect toGrpcProviders.GrpcClientBuilderProviderpublic static GrpcClientBuilder<HostAndPort,InetSocketAddress> forResolvedAddress(HostAndPort address)
GrpcClientBuilder for an address with default LoadBalancer.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
address - the ResolvedAddress to connect to.GrpcProviders.GrpcClientBuilderProviderpublic static GrpcClientBuilder<InetSocketAddress,InetSocketAddress> forResolvedAddress(InetSocketAddress address)
GrpcClientBuilder for an address with default LoadBalancer.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
address - the InetSocketAddress to connect to.GrpcProviders.GrpcClientBuilderProviderpublic static <T extends SocketAddress> GrpcClientBuilder<T,T> forResolvedAddress(T address)
GrpcClientBuilder for an address with default LoadBalancer.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
T - The type of SocketAddress.address - the ResolvedAddress to connect. This address will also be used for the
HttpHeaderNames.HOST.
Use SingleAddressHttpClientBuilder.unresolvedAddressToHost(Function)
via GrpcClientBuilder.initializeHttp(GrpcClientBuilder.HttpInitializer)
if you want to override that value or
SingleAddressHttpClientBuilder.hostHeaderFallback(boolean)
if you want to disable this behavior.GrpcProviders.GrpcClientBuilderProviderpublic static <U,R> GrpcClientBuilder<U,R> forAddress(ServiceDiscoverer<U,R,? extends ServiceDiscovererEvent<R>> serviceDiscoverer,
U address)
GrpcClientBuilder for a custom address type with default LoadBalancer and user
provided ServiceDiscoverer using background discovery strategy.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
U - the type of address before resolution (unresolved address)R - the type of address after resolution (resolved address)serviceDiscoverer - The ServiceDiscoverer to resolve addresses of remote servers to connect to.
The lifecycle of the provided ServiceDiscoverer should be managed by the caller.address - the UnresolvedAddress to connect to resolved using the provided serviceDiscoverer.GrpcProviders.GrpcClientBuilderProviderpublic static <U,R> GrpcClientBuilder<U,R> forAddress(ServiceDiscoverer<U,R,? extends ServiceDiscovererEvent<R>> serviceDiscoverer,
U address,
HttpClients.DiscoveryStrategy discoveryStrategy)
GrpcClientBuilder for a custom address type with default LoadBalancer and user
provided ServiceDiscoverer using the specified HttpClients.DiscoveryStrategy.
The returned builder can be customized using GrpcProviders.GrpcClientBuilderProvider.
U - the type of address before resolution (unresolved address)R - the type of address after resolution (resolved address)serviceDiscoverer - The ServiceDiscoverer to resolve addresses of remote servers to connect to.
The lifecycle of the provided ServiceDiscoverer should be managed by the caller.address - the UnresolvedAddress to connect to resolved using the provided serviceDiscoverer.discoveryStrategy - HttpClients.DiscoveryStrategy to useGrpcProviders.GrpcClientBuilderProvider