Skip to content
Docs Try Aspire

IDistributedApplicationEventing Methods

Interface Methods 5 members
Supports publishing and subscribing to events which are executed during the AppHost lifecycle.
PublishAsync(T, CancellationToken) Section titled PublishAsync(T, CancellationToken) abstract Task
Publishes an event to all subscribes of the specific event type.
public interface IDistributedApplicationEventing
{
public abstract Task PublishAsync<T>(
T @event,
CancellationToken cancellationToken = default(CancellationToken))
{
// ...
}
}
event T The event.
cancellationToken CancellationToken optional A cancellation token.
Task A task that can be awaited.
PublishAsync(T, EventDispatchBehavior, CancellationToken) Section titled PublishAsync(T, EventDispatchBehavior, CancellationToken) abstract Task
Publishes an event to all subscribes of the specific event type.
public interface IDistributedApplicationEventing
{
public abstract Task PublishAsync<T>(
T @event,
EventDispatchBehavior dispatchBehavior,
CancellationToken cancellationToken = default(CancellationToken))
{
// ...
}
}
event T The event.
dispatchBehavior EventDispatchBehavior The dispatch behavior for the event.
cancellationToken CancellationToken optional A cancellation token.
Task A task that can be awaited.
Subscribes a callback to a specific event type within the AppHost.
public interface IDistributedApplicationEventing
{
public abstract DistributedApplicationEventSubscription Subscribe<T>(
Func<T, CancellationToken, Task> callback)
{
// ...
}
}
callback Func<T, CancellationToken, Task> A callback to handle the event.
DistributedApplicationEventSubscription A subscription instance which can be used to unsubscribe
Subscribes a callback to a specific event type
public interface IDistributedApplicationEventing
{
public abstract DistributedApplicationEventSubscription Subscribe<T>(
IResource resource,
Func<T, CancellationToken, Task> callback)
{
// ...
}
}
resource IResource The resource instance associated with the event.
callback Func<T, CancellationToken, Task> A callback to handle the event.
DistributedApplicationEventSubscription A subscription instance which can be used to unsubscribe.
Unsubscribe(DistributedApplicationEventSubscription) Section titled Unsubscribe(DistributedApplicationEventSubscription) abstract
Unsubscribe from an event.
public interface IDistributedApplicationEventing
{
public abstract void Unsubscribe(
DistributedApplicationEventSubscription subscription)
{
// ...
}
}
subscription DistributedApplicationEventSubscription The specific subscription to unsubscribe.