Package io.servicetalk.grpc.api
Class GrpcClientFactory<Client extends GrpcClient<BlockingClient>,BlockingClient extends BlockingGrpcClient<Client>>
java.lang.Object
io.servicetalk.grpc.api.GrpcClientFactory<Client,BlockingClient>
- Type Parameters:
Client
- gRPC service that any client built from this factory represents.BlockingClient
- Blocking gRPC service that any client built from this builder represents.
- Direct Known Subclasses:
Health.ClientFactory
public abstract class GrpcClientFactory<Client extends GrpcClient<BlockingClient>,BlockingClient extends BlockingGrpcClient<Client>>
extends Object
A factory for creating clients that follows the specified gRPC
GrpcClientFactory
contract.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected BufferDecoderGroup
Get the supportedBufferDecoderGroup
for this client factory.bufferDecoderGroup
(BufferDecoderGroup bufferDecoderGroup) Sets the supportedBufferDecoderGroup
for this client factory.protected abstract BlockingClient
newBlockingClient
(GrpcClientCallFactory clientCallFactory) Create a new client that follows the specified gRPCGrpcClientFactory
contract using the passedGrpcClientCallFactory
.final BlockingClient
newBlockingClientForCallFactory
(GrpcClientCallFactory clientCallFactory) Create a new client that follows the specified gRPCGrpcClientFactory
contract using the passedGrpcClientCallFactory
.protected abstract Client
newClient
(GrpcClientCallFactory clientCallFactory) Create a new client that follows the specified gRPCGrpcClientFactory
contract using the passedGrpcClientCallFactory
.final Client
newClientForCallFactory
(GrpcClientCallFactory clientCallFactory) Create a new client that follows the specified gRPCGrpcClientFactory
contract using the passedGrpcClientCallFactory
.protected List<ContentCodec>
Deprecated.supportedMessageCodings
(List<ContentCodec> codings) Deprecated.
-
Constructor Details
-
GrpcClientFactory
public GrpcClientFactory()
-
-
Method Details
-
newClientForCallFactory
Create a new client that follows the specified gRPCGrpcClientFactory
contract using the passedGrpcClientCallFactory
.- Parameters:
clientCallFactory
-GrpcClientCallFactory
to use for creating client calls. The returnedGrpcClientFactory
should own the lifecycle of this factory.- Returns:
- A new gRPC client following the specified
gRPC
GrpcClientFactory
contract.
-
newBlockingClientForCallFactory
public final BlockingClient newBlockingClientForCallFactory(GrpcClientCallFactory clientCallFactory) Create a new client that follows the specified gRPCGrpcClientFactory
contract using the passedGrpcClientCallFactory
.- Parameters:
clientCallFactory
-GrpcClientCallFactory
to use for creating client calls. The returnedGrpcClientFactory
should own the lifecycle of this factory.- Returns:
- A new gRPC client following the specified
gRPC
GrpcClientFactory
contract.
-
supportedMessageCodings
@Deprecated public GrpcClientFactory<Client,BlockingClient> supportedMessageCodings(List<ContentCodec> codings) Deprecated.Sets the supported message encodings for this client factory. By default onlyIdentity.identity()
is supported- Parameters:
codings
- The supported encodingsContentCodec
s for this client.- Returns:
this
-
supportedMessageCodings
Deprecated.Return the supportedContentCodec
s for this client factory.- Returns:
- the supported
ContentCodec
s for this client factory.
-
bufferDecoderGroup
public GrpcClientFactory<Client,BlockingClient> bufferDecoderGroup(BufferDecoderGroup bufferDecoderGroup) Sets the supportedBufferDecoderGroup
for this client factory. By default onlyIdentity.identityEncoder()
is supportedBufferDecoderGroup
.- Parameters:
bufferDecoderGroup
- The supportedBufferDecoderGroup
for this client.- Returns:
this
-
bufferDecoderGroup
Get the supportedBufferDecoderGroup
for this client factory.- Returns:
- the supported
BufferDecoderGroup
for this client factory.
-
newClient
Create a new client that follows the specified gRPCGrpcClientFactory
contract using the passedGrpcClientCallFactory
.- Parameters:
clientCallFactory
-GrpcClientCallFactory
to use for creating client calls. The returnedGrpcClientFactory
should own the lifecycle of this factory.- Returns:
- A new gRPC client following the specified
gRPC
GrpcClientFactory
contract.
-
newBlockingClient
Create a new client that follows the specified gRPCGrpcClientFactory
contract using the passedGrpcClientCallFactory
.- Parameters:
clientCallFactory
-GrpcClientCallFactory
to use for creating client calls. The returnedGrpcClientFactory
should own the lifecycle of this factory.- Returns:
- A new gRPC client following the specified
gRPC
GrpcClientFactory
contract.
-
List
ofBufferEncoder
s andBufferDecoderGroup
.