# IDistributedApplicationEventing

- Kind: `interface`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.Eventing`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/Eventing/IDistributedApplicationEventing.cs)

Supports publishing and subscribing to events which are executed during the AppHost lifecycle.

## Definition

```csharp
namespace Aspire.Hosting.Eventing;

public interface IDistributedApplicationEventing
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting/IDistributedApplicationEventing`
- Public instance methods are exported as ATS capabilities.

## Methods

- [PublishAsync(T, CancellationToken)](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing/methods.md#publishasync-t-cancellationtoken) : `Task` `abstract` -- Publishes an event to all subscribes of the specific event type.
- [PublishAsync(T, EventDispatchBehavior, CancellationToken)](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing/methods.md#publishasync-t-eventdispatchbehavior-cancellationtoken) : `Task` `abstract` -- Publishes an event to all subscribes of the specific event type.
- [Subscribe(Func<T, CancellationToken, Task>)](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing/methods.md#subscribe-func-t-cancellationtoken-task) : [DistributedApplicationEventSubscription](/reference/api/csharp/aspire.hosting/distributedapplicationeventsubscription.md) `abstract` -- Subscribes a callback to a specific event type within the AppHost.
- [Subscribe(IResource, Func<T, CancellationToken, Task>)](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing/methods.md#subscribe-iresource-func-t-cancellationtoken-task) : [DistributedApplicationEventSubscription](/reference/api/csharp/aspire.hosting/distributedapplicationeventsubscription.md) `abstract` -- Subscribes a callback to a specific event type
- [Unsubscribe(DistributedApplicationEventSubscription)](/reference/api/csharp/aspire.hosting/idistributedapplicationeventing/methods.md#unsubscribe-distributedapplicationeventsubscription) `abstract` -- Unsubscribe from an event.
