Aracılığıyla paylaş


IStatefulServiceReplica.ChangeRoleAsync Method

Definition

Changes the role of the service replica to one of the ReplicaRole.

public System.Threading.Tasks.Task<string> ChangeRoleAsync (System.Fabric.ReplicaRole newRole, System.Threading.CancellationToken cancellationToken);
abstract member ChangeRoleAsync : System.Fabric.ReplicaRole * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function ChangeRoleAsync (newRole As ReplicaRole, cancellationToken As CancellationToken) As Task(Of String)

Parameters

newRole
ReplicaRole

The updated ReplicaRole that this replica should transition to.

cancellationToken
CancellationToken

The CancellationToken object that the operation is observing. It can be used to send a notification that the operation should be canceled. Note that cancellation is advisory and that the operation might still be completed even if it is canceled.

Returns

Returns Task<TResult> of type String, the service’s new connection address that is to be associated with the replica via Service Fabric Naming.

Remarks

The new role is indicated as a parameter. When the service transitions to the new role, the service has a chance to update its current listening address. The listening address is the address where clients connect to it and the one returned via the ResolveAsync API. This enables the service when it is a primary replica to only claim some resources such as ports when communication from clients is expected.

https://docs.microsoft.com/azure/service-fabric/service-fabric-reliable-services-communication

Applies to