FabricClient.HealthClient.GetReplicaHealthAsync Method

Definition

Overloads

GetReplicaHealthAsync(Guid, Int64, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric replica by using the specified timeout and cancellation token.

GetReplicaHealthAsync(Guid, Int64, ApplicationHealthPolicy)

Asynchronously gets the health of a Service Fabric replica.

GetReplicaHealthAsync(Guid, Int64, ApplicationHealthPolicy, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric replica by using the specified timeout and cancellation token.

GetReplicaHealthAsync(Guid, Int64)

Asynchronously gets the health of a Service Fabric replica.

GetReplicaHealthAsync(ReplicaHealthQueryDescription)

Asynchronously gets the health of a Service Fabric replica specified by the query description.

GetReplicaHealthAsync(ReplicaHealthQueryDescription, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric replica by using the specified timeout and cancellation token.

GetReplicaHealthAsync(Guid, Int64, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric replica by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth> GetReplicaHealthAsync (Guid partitionId, long replicaId, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.GetReplicaHealthAsync : Guid * int64 * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth>
Public Function GetReplicaHealthAsync (partitionId As Guid, replicaId As Long, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of ReplicaHealth)

Parameters

partitionId
Guid

The ID of the Service Fabric partition.

replicaId
Int64

The ID of the Service Fabric replica.

timeout
TimeSpan

The maximum amount of time Service Fabric will allow this operation to continue before returning a TimeoutException.

cancellationToken
CancellationToken

The optional cancellation token 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 may still be completed even if it is canceled.

Returns

Task<ReplicaHealth>

The health of a Service Fabric replica.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the user provided timeout to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to

GetReplicaHealthAsync(Guid, Int64, ApplicationHealthPolicy)

Asynchronously gets the health of a Service Fabric replica.

public System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth> GetReplicaHealthAsync (Guid partitionId, long replicaId, System.Fabric.Health.ApplicationHealthPolicy healthPolicy);
member this.GetReplicaHealthAsync : Guid * int64 * System.Fabric.Health.ApplicationHealthPolicy -> System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth>
Public Function GetReplicaHealthAsync (partitionId As Guid, replicaId As Long, healthPolicy As ApplicationHealthPolicy) As Task(Of ReplicaHealth)

Parameters

partitionId
Guid

The ID of the Service Fabric partition.

replicaId
Int64

The ID of the Service Fabric replica.

healthPolicy
ApplicationHealthPolicy

The application health policy used to evaluate the entity health.

Returns

Task<ReplicaHealth>

The health of a Service Fabric replica.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the specified time to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to

GetReplicaHealthAsync(Guid, Int64, ApplicationHealthPolicy, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric replica by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth> GetReplicaHealthAsync (Guid partitionId, long replicaId, System.Fabric.Health.ApplicationHealthPolicy healthPolicy, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.GetReplicaHealthAsync : Guid * int64 * System.Fabric.Health.ApplicationHealthPolicy * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth>
Public Function GetReplicaHealthAsync (partitionId As Guid, replicaId As Long, healthPolicy As ApplicationHealthPolicy, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of ReplicaHealth)

Parameters

partitionId
Guid

The ID of the Service Fabric partition.

replicaId
Int64

The ID of the Service Fabric replica.

healthPolicy
ApplicationHealthPolicy

The application health policy used to evaluate the entity health.

timeout
TimeSpan

The maximum amount of time Service Fabric will allow this operation to continue before returning a TimeoutException.

cancellationToken
CancellationToken

The optional cancellation token 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 may still be completed even if it is canceled.

Returns

Task<ReplicaHealth>

The health of a Service Fabric replica.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the user provided timeout to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to

GetReplicaHealthAsync(Guid, Int64)

Asynchronously gets the health of a Service Fabric replica.

public System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth> GetReplicaHealthAsync (Guid partitionId, long replicaId);
member this.GetReplicaHealthAsync : Guid * int64 -> System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth>
Public Function GetReplicaHealthAsync (partitionId As Guid, replicaId As Long) As Task(Of ReplicaHealth)

Parameters

partitionId
Guid

The ID of the Service Fabric partition.

replicaId
Int64

The ID of the Service Fabric replica.

Returns

Task<ReplicaHealth>

The health of a Service Fabric replica.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the specified time to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Remarks

The following example gets the health of a replica.

```csharp public static bool GetReplicaHealth(string clusterConnection) { ReplicaHealth replicaHealth;

// Connect to the cluster. FabricClient fabricClient = new FabricClient(clusterConnection);

// Get the replica health. try { replicaHealth = fabricClient.HealthManager.GetReplicaHealthAsync( new Guid("a7206315-e53b-4d05-b59c-e210caa28893"), 130538257146083818).Result; } catch (Exception e) { Console.WriteLine("Error: " + e.Message);

if (e.InnerException != null) Console.WriteLine(" Inner Exception: " + e.InnerException.Message);

return false; }

Console.WriteLine("Replica Health:"); Console.WriteLine(" ID: " + replicaHealth.Id); Console.WriteLine(" Aggregated Health State: " + replicaHealth.AggregatedHealthState); Console.WriteLine(" Kind: " + replicaHealth.Kind); Console.WriteLine(" Partition ID: " + replicaHealth.PartitionId);

// List the health events. Console.WriteLine(" Health Events:"); IList

Applies to

GetReplicaHealthAsync(ReplicaHealthQueryDescription)

Asynchronously gets the health of a Service Fabric replica specified by the query description.

public System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth> GetReplicaHealthAsync (System.Fabric.Description.ReplicaHealthQueryDescription queryDescription);
member this.GetReplicaHealthAsync : System.Fabric.Description.ReplicaHealthQueryDescription -> System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth>
Public Function GetReplicaHealthAsync (queryDescription As ReplicaHealthQueryDescription) As Task(Of ReplicaHealth)

Parameters

queryDescription
ReplicaHealthQueryDescription

The query description.

Returns

Task<ReplicaHealth>

The health of a Service Fabric replica.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the specified time to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to

GetReplicaHealthAsync(ReplicaHealthQueryDescription, TimeSpan, CancellationToken)

Asynchronously gets the health of a Service Fabric replica by using the specified timeout and cancellation token.

public System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth> GetReplicaHealthAsync (System.Fabric.Description.ReplicaHealthQueryDescription queryDescription, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.GetReplicaHealthAsync : System.Fabric.Description.ReplicaHealthQueryDescription * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Fabric.Health.ReplicaHealth>
Public Function GetReplicaHealthAsync (queryDescription As ReplicaHealthQueryDescription, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of ReplicaHealth)

Parameters

queryDescription
ReplicaHealthQueryDescription

The query description.

timeout
TimeSpan

The maximum amount of time Service Fabric will allow this operation to continue before returning a TimeoutException.

cancellationToken
CancellationToken

The optional cancellation token 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 may still be completed even if it is canceled.

Returns

Task<ReplicaHealth>

The health of a Service Fabric replica.

Exceptions

The FabricClient object is in a closed state. Dispose of the FabricClient object you are using and instantiate a new FabricClient object.

Returned when a null reference is passed to a method that does not accept it as a valid argument.

Caused by one of the following:

E_INVALIDARG is returned when one or more arguments are not valid.

Caused by one of the following:

OperationTimedOut is returned when the operation takes more than the user provided timeout to complete.

Caused by one of the following:

ServiceTooBusy is returned when the service is too busy to process the operation.

Caused by one of the following:

E_ACCESSDENIED is returned when the access check has failed for this operation.

Applies to