Condividi tramite


ResourceNotificationService.WaitForResourceAsync Method

Definition

Overloads

WaitForResourceAsync(String, IEnumerable<String>, CancellationToken)

Waits for a resource to reach one of the specified states. See KnownResourceStates for common states.

WaitForResourceAsync(String, Func<ResourceEvent,Boolean>, CancellationToken)

Waits until a resource satisfies the specified predicate.

WaitForResourceAsync(String, String, CancellationToken)

Waits for a resource to reach the specified state. See KnownResourceStates for common states.

WaitForResourceAsync(String, IEnumerable<String>, CancellationToken)

Source:
ResourceNotificationService.cs
Source:
ResourceNotificationService.cs

Waits for a resource to reach one of the specified states. See KnownResourceStates for common states.

public System.Threading.Tasks.Task<string> WaitForResourceAsync (string resourceName, System.Collections.Generic.IEnumerable<string> targetStates, System.Threading.CancellationToken cancellationToken = default);
member this.WaitForResourceAsync : string * seq<string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function WaitForResourceAsync (resourceName As String, targetStates As IEnumerable(Of String), Optional cancellationToken As CancellationToken = Nothing) As Task(Of String)

Parameters

resourceName
String

The name of the resource.

targetStates
IEnumerable<String>

The set of states to wait for the resource to transition to one of. See KnownResourceStates for common states.

cancellationToken
CancellationToken

A cancellation token that cancels the wait operation when signaled.

Returns

A Task<TResult> representing the wait operation and which of the target states the resource reached.

Remarks

This method returns a task that will complete when the resource reaches one of the specified target states. If the resource is already in the target state, the method will return immediately.
If the resource doesn't reach one of the target states before cancellationToken is signaled, this method will throw OperationCanceledException.

Applies to

WaitForResourceAsync(String, Func<ResourceEvent,Boolean>, CancellationToken)

Source:
ResourceNotificationService.cs

Waits until a resource satisfies the specified predicate.

public System.Threading.Tasks.Task<Aspire.Hosting.ApplicationModel.ResourceEvent> WaitForResourceAsync (string resourceName, Func<Aspire.Hosting.ApplicationModel.ResourceEvent,bool> predicate, System.Threading.CancellationToken cancellationToken = default);
member this.WaitForResourceAsync : string * Func<Aspire.Hosting.ApplicationModel.ResourceEvent, bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Aspire.Hosting.ApplicationModel.ResourceEvent>
Public Function WaitForResourceAsync (resourceName As String, predicate As Func(Of ResourceEvent, Boolean), Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResourceEvent)

Parameters

resourceName
String

The name of the resource.

predicate
Func<ResourceEvent,Boolean>

A predicate which is evaluated for each ResourceEvent for the selected resource.

cancellationToken
CancellationToken

A cancellation token that cancels the wait operation when signaled.

Returns

A Task<TResult> representing the wait operation and which of the target states the resource reached.

Remarks

This method returns a task that will complete when the specified predicate returns true.
If the predicate isn't satisfied before cancellationToken is signaled, this method will throw OperationCanceledException.

Applies to

WaitForResourceAsync(String, String, CancellationToken)

Source:
ResourceNotificationService.cs
Source:
ResourceNotificationService.cs

Waits for a resource to reach the specified state. See KnownResourceStates for common states.

public System.Threading.Tasks.Task WaitForResourceAsync (string resourceName, string? targetState = default, System.Threading.CancellationToken cancellationToken = default);
member this.WaitForResourceAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WaitForResourceAsync (resourceName As String, Optional targetState As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

resourceName
String

The name of the resource.

targetState
String

The state to wait for the resource to transition to. See KnownResourceStates for common states.

cancellationToken
CancellationToken

A CancellationToken.

Returns

A Task representing the wait operation.

Remarks

This method returns a task that will complete when the resource reaches the specified target state. If the resource is already in the target state, the method will return immediately.
If the resource doesn't reach one of the target states before cancellationToken is signaled, this method will throw OperationCanceledException.

Applies to