CommunicationClientFactoryBase<T> Class
- java.
lang. Object - CommunicationClientFactory<TCommunicationClient>
- microsoft.
servicefabric. services. communication. client. CommunicationClientFactoryBase<T>
- microsoft.
Type Parameters
- T
The type of communication client
public class CommunicationClientFactoryBase implements CommunicationClientFactory
Provides the base implementation of CommunicationClientFactory for creating communication clients to talk to service fabric services. Extend the CommunicationClientFactoryBase class to create communication clients for custom transport implementations. This class maintains a cache of communication clients and attempts to reuse the clients for requests to the same service endpoint.
Constructor Summary
Constructor | Description |
---|---|
CommunicationClientFactoryBase() |
Initializes a new instance of the communication client factory. |
CommunicationClientFactoryBase(ServicePartitionResolver servicePartitionResolver, List<ExceptionHandler> exceptionHandlers) |
Initializes a new instance of the communication client factory. |
CommunicationClientFactoryBase(ServicePartitionResolver servicePartitionResolver, List<ExceptionHandler> exceptionHandlers, String traceId) |
Initializes a new instance of the communication client factory. |
Method Summary
Modifier and Type | Method and Description |
---|---|
abstract void |
abortClient(T client)
Aborts the given client |
abstract CompletableFuture<T> | createClientAsync(String endpoint) |
CompletableFuture<T> |
getClientAsync(ResolvedServicePartition previousRsp, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)
Resolves a partition of the specified service containing one or more communication listeners and returns a client to communicate to the endpoint corresponding to the given listenerName. The endpoint of the service is of the form - {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}} |
CompletableFuture<T> |
getClientAsync(URI serviceUri, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)
Resolves a partition of the specified service containing one or more communication listeners and returns a client to communicate to the endpoint corresponding to the given listenerName. The endpoint of the service is of the form - {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}} |
List<Exception |
getExceptionHandlers()
Gets the custom exception handlers for handling exceptions on the client to service communication channel. |
Service |
getServiceResolver()
Gets the ServicePartitionResolver used by the client factory for resolving the service endpoint. |
String |
getTraceId()
Gets the trace identifier that is used to identify an instance of the CommunicationClientFactory. This is used as a correlation identifier for tracing/logging. |
CompletableFuture<Operation |
reportOperationExceptionAsync(T client, ExceptionInformation exceptionInformation, OperationRetrySettings retrySettings)
Handles the exceptions that occur in the CommunicationClient when sending a message to the Service |
abstract boolean |
validateClient(String endpoint, T client)
Returns true if the client is still valid and connected to the endpoint specified in the parameter. |
abstract boolean |
validateClient(T client)
Returns true if the client is still valid. Connection oriented transports can use this method to indicate that the client is no longer connected to the service. |
Inherited Members
Constructor Details
CommunicationClientFactoryBase
protected CommunicationClientFactoryBase()
Initializes a new instance of the communication client factory.
CommunicationClientFactoryBase
protected CommunicationClientFactoryBase(ServicePartitionResolver servicePartitionResolver, List
Initializes a new instance of the communication client factory.
Parameters:
CommunicationClientFactoryBase
protected CommunicationClientFactoryBase(ServicePartitionResolver servicePartitionResolver, List
Initializes a new instance of the communication client factory.
Parameters:
Method Details
abortClient
protected abstract void abortClient(T client)
Aborts the given client
Parameters:
createClientAsync
protected abstract CompletableFuture
Parameters:
getClientAsync
public CompletableFuture
Resolves a partition of the specified service containing one or more communication listeners and returns a client to communicate to the endpoint corresponding to the given listenerName. The endpoint of the service is of the form - {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}
Parameters:
Returns:
getClientAsync
public CompletableFuture
Resolves a partition of the specified service containing one or more communication listeners and returns a client to communicate to the endpoint corresponding to the given listenerName. The endpoint of the service is of the form - {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}
Parameters:
Returns:
getExceptionHandlers
public List
Gets the custom exception handlers for handling exceptions on the client to service communication channel.
Returns:
getServiceResolver
public ServicePartitionResolver getServiceResolver()
Gets the ServicePartitionResolver used by the client factory for resolving the service endpoint.
Returns:
getTraceId
protected String getTraceId()
Gets the trace identifier that is used to identify an instance of the CommunicationClientFactory. This is used as a correlation identifier for tracing/logging.
Returns:
reportOperationExceptionAsync
public CompletableFuture
Handles the exceptions that occur in the CommunicationClient when sending a message to the Service
Parameters:
Returns:
validateClient
protected abstract boolean validateClient(String endpoint, T client)
Returns true if the client is still valid and connected to the endpoint specified in the parameter.
Parameters:
Returns:
validateClient
protected abstract boolean validateClient(T client)
Returns true if the client is still valid. Connection oriented transports can use this method to indicate that the client is no longer connected to the service.
Parameters:
Returns:
Applies to
Azure SDK for Java