# DistributedApplicationEventSubscription

- Kind: `class`
- 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/DistributedApplicationEventSubscription.cs)

Represents a subscription to an event that is published during the lifecycle of the AppHost.

## Definition

```csharp
namespace Aspire.Hosting.Eventing;

public class DistributedApplicationEventSubscription
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting/DistributedApplicationEventSubscription`

## Constructors

- [DistributedApplicationEventSubscription(Func<IDistributedApplicationEvent, CancellationToken, Task>)](/reference/api/csharp/aspire.hosting/distributedapplicationeventsubscription/constructors.md#constructor-func-idistributedapplicationevent-cancellationtoken-task) -- Represents a subscription to an event that is published during the lifecycle of the AppHost.

## Properties

- [Callback](/reference/api/csharp/aspire.hosting/distributedapplicationeventsubscription/properties.md#callback) : `Func<IDistributedApplicationEvent, CancellationToken, Task>` `get` -- The callback to be executed when the event is published.
