다음을 통해 공유


FabricServicePartitionClient<C> Class

Type Parameters

C

type of Communication client

public class FabricServicePartitionClient implements ServicePartitionClient

Specifies an instance of the communication client that can communicate with the replicas of a particular partition.

Constructor Summary

Constructor Description
FabricServicePartitionClient(CommunicationClientFactory<C> factory, URI serviceName)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri argument.

FabricServicePartitionClient(CommunicationClientFactory<C> factory, URI serviceName, ServicePartitionKey partitionKey)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri, partitionkey arguments.

FabricServicePartitionClient(CommunicationClientFactory<C> factory, URI serviceName, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri, partitionkey and replica selector arguments.

FabricServicePartitionClient(CommunicationClientFactory<C> factory, URI serviceName, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri, partitionkey, replica and listener arguments.

FabricServicePartitionClient(CommunicationClientFactory<C> factory, URI serviceName, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri, partitionkey, replica and listener arguments.

Method Summary

Modifier and Type Method and Description
CommunicationClientFactory<C> getCommunicationClientFactory()

Gets the communication client factory

ResolvedServicePartition getLastResolvedServicePartition()

Gets the resolved service partition that was set on the client.

String getListenerName()

Gets the name of the listener in the replica to which the client should connect to.

ServicePartitionKey getPartitionKey()

Gets the partition key.

URI getServiceUri()

Gets the name of the service

TargetReplicaSelector getTargetReplicaSelector()

Gets the information about which replica in the partition the client should connect to.

<T> CompletableFuture<T> invokeWithRetryAsync(Function<C, CompletableFuture<T>> func, CancellationToken cancellationToken, Class<?>... doNotRetryExceptionTypes)

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not.

<T> CompletableFuture<T> invokeWithRetryAsync(Function<C, CompletableFuture<T>> func, Class<?>... doNotRetryExceptionTypes)

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not.

Constructor Details

FabricServicePartitionClient

public FabricServicePartitionClient(CommunicationClientFactory factory, URI serviceName)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri argument.

Parameters:

factory - Communication client factory
serviceName - Name of the service

FabricServicePartitionClient

public FabricServicePartitionClient(CommunicationClientFactory factory, URI serviceName, ServicePartitionKey partitionKey)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri, partitionkey arguments.

Parameters:

factory - Communication client factory
serviceName - Name of the service
partitionKey - The partition key used to identify the partition within the service.

FabricServicePartitionClient

public FabricServicePartitionClient(CommunicationClientFactory factory, URI serviceName, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri, partitionkey and replica selector arguments.

Parameters:

factory - Communication client factory
serviceName - Name of the service
partitionKey - The partition key used to identify the partition within the service.
targetReplicaSelector - Target replica information

FabricServicePartitionClient

public FabricServicePartitionClient(CommunicationClientFactory factory, URI serviceName, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri, partitionkey, replica and listener arguments.

Parameters:

factory - Communication client factory
serviceName - Name of the service
partitionKey - The partition key used to identify the partition within the service.
targetReplicaSelector - Target replica information
listenerName - Listener in the replica to which the client should connect to

FabricServicePartitionClient

public FabricServicePartitionClient(CommunicationClientFactory factory, URI serviceName, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName, OperationRetrySettings retrySettings)

Instantiates a service partition client that uses the specified communication client factory to create a client to talk to the service endpoint identified by the service uri, partitionkey, replica and listener arguments.

Parameters:

factory - Communication client factory
serviceName - Name of the service
partitionKey - The partition key used to identify the partition within the service.
targetReplicaSelector - Target replica information
listenerName - Listener in the replica to which the client should connect to
retrySettings - Retry policy for exceptions seen during communication

Method Details

getCommunicationClientFactory

public CommunicationClientFactory getCommunicationClientFactory()

Gets the communication client factory

Returns:

Communication client factory

getLastResolvedServicePartition

public ResolvedServicePartition getLastResolvedServicePartition()

Gets the resolved service partition that was set on the client.

Returns:

true if a ResolvedServicePartition was set

getListenerName

public String getListenerName()

Gets the name of the listener in the replica to which the client should connect to.

Returns:

Listener name

getPartitionKey

public ServicePartitionKey getPartitionKey()

Gets the partition key.

Returns:

Partition key

getServiceUri

public URI getServiceUri()

Gets the name of the service

Returns:

Name of the service

getTargetReplicaSelector

public TargetReplicaSelector getTargetReplicaSelector()

Gets the information about which replica in the partition the client should connect to.

Returns:

invokeWithRetryAsync

public CompletableFuture invokeWithRetryAsync(Function> func, CancellationToken cancellationToken, Class... doNotRetryExceptionTypes)

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not.

Parameters:

func - Function being invoked
cancellationToken - Token to signal the cancellation of async operation.
doNotRetryExceptionTypes - Exceptions for which the service partition client should not retry

Returns:

A CompletableFuture that represents outstanding operation. The result of the Task is the result from the function given in the argument.

invokeWithRetryAsync

public CompletableFuture invokeWithRetryAsync(Function> func, Class... doNotRetryExceptionTypes)

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not.

Parameters:

func - Function being invoked
doNotRetryExceptionTypes - Exceptions for which the service partition client should not retry

Returns:

A CompletableFuture that represents outstanding operation. The result of the Task is the result from the function given in the argument.

Applies to