Partager via


CommunicationClientFactory<TCommunicationClient> Interface

Type Parameters

TCommunicationClient

public interface CommunicationClientFactory

Defines the interface that must be implemented to provide a factory for communication clients to talk to a service fabric service.

Method Summary

Modifier and Type Method and Description
CompletableFuture<TCommunicationClient> getClientAsync(ResolvedServicePartition previousRsp, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)

Re-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<TCommunicationClient> 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" ...}}

CompletableFuture<OperationRetryControl> reportOperationExceptionAsync(TCommunicationClient client, ExceptionInformation exceptionInformation, OperationRetrySettings retrySettings)

Handles the exceptions that occur in the CommunicationClient when sending a message to the Service

Method Details

getClientAsync

public CompletableFuture getClientAsync(ResolvedServicePartition previousRsp, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)

Re-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:

previousRsp - Previous ResolvedServicePartition value
targetReplicaSelector - Specifies which replica in the partition identified by the partition key, the client should connect to
listenerName - Specifies which listener in the endpoint of the chosen replica, to which the client should connect to
retrySettings - Specifies the retry policy that should be used for exceptions that occur when creating the client.

Returns:

A CompletableFuture that represents outstanding operation. The result of the Task is the CommunicationClient(CommunicationClient) object.

getClientAsync

public CompletableFuture 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" ...}}

Parameters:

serviceUri - Uri of the service to resolve
partitionKey - Key that identifies the partition to resolve
targetReplicaSelector - Specifies which replica in the partition identified by the partition key, the client should connect to
listenerName - Specifies which listener in the endpoint of the chosen replica, to which the client should connect to
retrySettings - Specifies the retry policy that should be used for exceptions that occur when creating the client.

Returns:

A CompletableFuture that represents outstanding operation. The result of the Task is the CommunicationClient(CommunicationClient) object.

reportOperationExceptionAsync

public CompletableFuture reportOperationExceptionAsync(TCommunicationClient client, ExceptionInformation exceptionInformation, OperationRetrySettings retrySettings)

Handles the exceptions that occur in the CommunicationClient when sending a message to the Service

Parameters:

client - Communication client
exceptionInformation - Information about exception that happened while communicating with the service.
retrySettings - Specifies the retry policy that should be used for handling the reported exception.

Returns:

A CompletableFuture that represents outstanding operation. The result of the Task is a OperationRetryControl object that provides information on retry policy for this exception.

Applies to