DistributedApplicationEventing.Subscribe Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 within the AppHost. |
Subscribe<T>(Func<T,CancellationToken,Task>)
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)
override this.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
Implements
Applies to
Subscribe<T>(IResource, Func<T,CancellationToken,Task>)
Subscribes a callback to a specific event type within the AppHost.
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)
override this.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
- callback
- Func<T,CancellationToken,Task>
A callback to handle the event.
Returns
A subscription instance which can be used to unsubscribe