Share via


IDistributedApplicationEventing.Subscribe Method

Definition

Overloads

Subscribe<T>(Func<T,CancellationToken,Task>)

Subscribes a callback to a specific event type within the AppHost.

Subscribe<T>(IResource, Func<T,CancellationToken,Task>)

Subscribes a callback to a specific event type

Subscribe<T>(Func<T,CancellationToken,Task>)

Source:
IDistributedApplicationEventing.cs
Source:
IDistributedApplicationEventing.cs

Subscribes a callback to a specific event type within the AppHost.

public Aspire.Hosting.Eventing.DistributedApplicationEventSubscription Subscribe<T> (Func<T,System.Threading.CancellationToken,System.Threading.Tasks.Task> callback) where T : Aspire.Hosting.Eventing.IDistributedApplicationEvent;
abstract member Subscribe : Func<'T, System.Threading.CancellationToken, System.Threading.Tasks.Task (requires 'T :> Aspire.Hosting.Eventing.IDistributedApplicationEvent)> -> Aspire.Hosting.Eventing.DistributedApplicationEventSubscription (requires 'T :> Aspire.Hosting.Eventing.IDistributedApplicationEvent)
Public Function Subscribe(Of T As IDistributedApplicationEvent) (callback As Func(Of T, CancellationToken, Task)) As DistributedApplicationEventSubscription

Type Parameters

T

The type of the event.

Parameters

callback
Func<T,CancellationToken,Task>

A callback to handle the event.

Returns

A subscription instance which can be used to unsubscribe

Applies to

Subscribe<T>(IResource, Func<T,CancellationToken,Task>)

Source:
IDistributedApplicationEventing.cs
Source:
IDistributedApplicationEventing.cs

Subscribes a callback to a specific event type

public Aspire.Hosting.Eventing.DistributedApplicationEventSubscription Subscribe<T> (Aspire.Hosting.ApplicationModel.IResource resource, Func<T,System.Threading.CancellationToken,System.Threading.Tasks.Task> callback) where T : Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent;
abstract member Subscribe : Aspire.Hosting.ApplicationModel.IResource * Func<'T, System.Threading.CancellationToken, System.Threading.Tasks.Task (requires 'T :> Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent)> -> Aspire.Hosting.Eventing.DistributedApplicationEventSubscription (requires 'T :> Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent)
Public Function Subscribe(Of T As IDistributedApplicationResourceEvent) (resource As IResource, callback As Func(Of T, CancellationToken, Task)) As DistributedApplicationEventSubscription

Type Parameters

T

The type of the event.

Parameters

resource
IResource

The resource instance associated with the event.

callback
Func<T,CancellationToken,Task>

A callback to handle the event.

Returns

A subscription instance which can be used to unsubscribe.

Applies to